www.digitalmars.com         C & C++   DMDScript  

c++.stlsoft - FastFormat 0.2.1 (alpha 7) released

reply Matt Wilson <matthewwilson acm.org> writes:
FastFormat is an Open Source C/C++ Output/Formatting library, whose design
parameters are 100% type-safety, efficiency, genericity and extensibility. It
is simple to use and extend, highly-portable (platform and
compiler-independent) and, best of all, it upholds the C tradition of you only
pay for what you use.

FastFormat supports output/formatting of statements of arbitrary complexity,
consisting of heterogeneous types.

FastFormat writes to output "sinks", which can be of arbitrary type. It
implicitly supports any type that is structurally conformant with the standard
library's string, and the library includes adaptors to allow writing to
std::ostream, FILE*, speech (currently Windows-only), STLSoft's auto_buffer,
C-style string buffers, and character buffers. Adaptation to a new type merely
requires the definition of a single function.

FastFormat is fast. The processing of each statement involves at most one
memory allocation to hold the entire statement, and each statement element is
measured and copied exactly once. As a consequence, the library is on a par
with (the type-unsafe) C's Streams (printf()-family) of functions, faster than
C++'s IOStreams, and considerably faster than Boost.Format. Comprehensive
performance analyses are underway: initial results of a realistic scenario on
Windows (32-bit) with Visual C++ 9 shows FastFormat is approximately 3 x faster
than C's Streams, 6 x faster than C++'s IOStreams, and 17 x faster than
Boost.Format.

FastFormat supports I18N/L10N by using numbered arguments, enabling reordering
of arguments by exchanging format strings. The library comes with a number of
resource bundles, classes whose instances can load sets of localised resource
strings for use as format strings.

FastFormat does not contain any compiler-specific or platform-specific
constructs. It supports UNIX (including Linux and Mac OS-X), and Windows, and
should work with any operating system. It is known to be compatible with Comeau
(4.3.3+), GCC (3.4+), Intel (8+), Metrowerks (8+), Microsoft Visual C++ (6.0+),
and should work with any reasonably modern C++ compiler.

FastFormat is completely free and includes source released under a BSD-style
license. Commercial customisations and related consultancy are provided by
Synesis Software Pty Ltd; http://synesis.com.au/contact.html)

Release 0.2.1 alpha 7 is the first public release.
 * changed internal includes to absolute, to placate CodeWarrior
 * corrected defective length calculation in case where replacement mismatches
are ignored
 * corrected erroneous parse code passed to handler on invalid index
 * slight modification to replacement algorithm
 * ff_format_element_t now only fwd-defined in fastformat/fastformat.h

Download from: http://sourceforge.net/project/showfiles.php?group_id=177382&package_id=204396

Discuss at: http://sourceforge.net/forum/forum.php?forum_id=612781

FastFormat website: http://fastformat.org/

Note: this release of FastFormat requires STLSoft 1.9.60, or later. Download
from http://stlsoft.org/
Nov 09 2008
parent reply Jerzy Adamowski <JerzyPiotrAdamowski __cut__gmail.c__cut__om> writes:
I find few compability issue:

I was trying build FastFormat.core project in Unicode base characters and with
FASTFORMAT_USE_WIDE_STRING on VS2008 (VC9). 

This is what i get:

1>C:\Tools\libraries\fastformat-0.2.1-alpha-7\include\fastform
t/fastformat.h(908) : error C2440: 'return' : cannot convert from 'const
fastformat::ff_char_t *const ' to 'const char *const '
1>        Types pointed to are unrelated; conversion requires reinterpret_cast,
C-style cast or function-style cast

If you look on code:
inline char const* c_str_data_a(
#if !defined(FASTFORMAT_NO_NAMESPACE)
::fastformat::
#endif /* !FASTFORMAT_NO_NAMESPACE */
ff_string_slice_t const& slice
)
{
	return slice.ptr;
}

I suppose that compiler try cast wchar_t to char... . I find earlier macro for
mutli/unicode characters but is never used:










but c_str_data_a is call explicit.

For MultiByte works well.
PS: Why fastformat wasnt prepared in template without all compilation things
like *.cpp :)?
BTW i use STLSoft more than 1 year so far, and i think is great Job. More
usefull and user friendly than Boost milion times ;).

Re
Jerzy Adamowski
Nov 09 2008
parent "Matthew Wilson" <matthew hat.stlsoft.dot.org> writes:
"Jerzy Adamowski" <JerzyPiotrAdamowski __cut__gmail.c__cut__om> wrote in
message news:gf754c$1se6$1 digitalmars.com...
 I find few compability issue:

 I was trying build FastFormat.core project in Unicode base characters and with
FASTFORMAT_USE_WIDE_STRING on VS2008 (VC9).

 This is what i get:

 1>C:\Tools\libraries\fastformat-0.2.1-alpha-7\include\fastform
t/fastformat.h(908) : error C2440: 'return' : cannot convert from
'const fastformat::ff_char_t *const ' to 'const char *const '
 1>        Types pointed to are unrelated; conversion requires
reinterpret_cast, C-style cast or function-style cast

 If you look on code:
 inline char const* c_str_data_a(
 #if !defined(FASTFORMAT_NO_NAMESPACE)
 ::fastformat::
 #endif /* !FASTFORMAT_NO_NAMESPACE */
 ff_string_slice_t const& slice
 )
 {
 return slice.ptr;
 }

 I suppose that compiler try cast wchar_t to char... . I find earlier macro for
mutli/unicode characters but is never used:










 but c_str_data_a is call explicit.

 For MultiByte works well.
Thanks for catching this problem. It's now fixed, as of 0.2.1 alpha 8. In the future, feel free to report bugs directly to the project tracker: https://sourceforge.net/tracker/?group_id=177382&atid=881010 :-)
 PS: Why fastformat wasnt prepared in template without all compilation things
like *.cpp :)?
Do you mean 100% header-only? It would have been very difficult to achieve this, and I judged it not worth the effort to try.
 BTW i use STLSoft more than 1 year so far, and i think is great Job. More
usefull and user friendly than Boost milion times ;).
Thanks! :-) Matt
Nov 10 2008