Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Release: stdlib v1.0-beta

39 views
Skip to first unread message

Alf P. Steinbach

unread,
Jun 30, 2017, 8:00:15 PM6/30/17
to
stdlib - UTF8 console i/o in Windows, other crucial fixes, functional
area headers

https://github.com/alf-p-steinbach/stdlib


stdlib is a pure header library that provides

• fixes for some standard library issues, including that
<stdlib/console_io.hpp> makes Windows console i/o work for international
text such as Norwegian (more precisely the Basic Multilingual Plane of
Unicode is supported for the iostreams objects such as cout), with
narrow text encoded as UTF-8;
• C++ library header wrappers for all C++ standard library headers, e.g.
you can just include <stdlib/iostream.hpp> where you want the <iostream>
header with the Windows console i/o fix, plus some;
• C library header wrappers, e.g. <stdlib/math.hpp> which for maximal
portability includes both <cmath> and <math.h> for you, and ditto for
the other C library headers;
• functional area headers for the C++ standard library, e.g. just
include <stdlib/io.hpp> to get all the C++ iostreams headers plus the C
standard library’s i/o headers, more precisely all headers in this
category mentioned in the header overview at cppreference.com; and
• extensions such as <stdlib/byte_to_wide_converter.hpp>, which provides
the class that’s used for narrow and wide encoding conversion in the
Windows console i/o fix. Most of the extensions are part of the library
implementation anyway, so they’re provided in a reusable form in the
public interface. Those that are not directly used in the current
library code, are provided for completeness.

Other fixes & nice-to-haves include

• support for de facto standard <math.h> constants such as M_PI;
• support for the C++ standard’s alternative keywords such as and, or
and not, in Visual C++;
• random seed for C++11 random number generation with g++;
• support for output of something that converts implicitly to wchar
const*, on a wide stream, corresponding to how something that converts
implicitly to char const* can be output an a narrow stream;
• setting the default locale in C and C++ to the user’s native locale,
which makes the wide iostreams work for international text in *nix-land;
• setting UTF-8 as the basic execution character set (i.e. for narrow
literals) in Visual C++; and just because it’s nice to have in a
portable way,
• support for ANSI escape sequences, e.g. to produce colored console
text or move the text cursor on the screen, in Windows 10 and later.


Cheers!, & enjoy,

- Alf

Mr Flibble

unread,
Jun 30, 2017, 11:07:08 PM6/30/17
to
Nope. Name "stdlib" remains egregious for reasons that should be obvious.

/Flibble

Richard

unread,
Jul 5, 2017, 2:02:22 PM7/5/17
to
[Please do not mail me a copy of your followup]

"Alf P. Steinbach" <alf.p.stein...@gmail.com> spake the secret code
<oj6oem$aja$1...@dont-email.me> thusly:

>stdlib - UTF8 console i/o in Windows, other crucial fixes, functional
>area headers

Seems useful, but unfortunately a name like "stdlib" is a really poor
name for this library IMO. It implies that this is somehow conencted
with the C++ Standard Library, as opposed to a user written layer on top.

Off the top of my head, names like "handylib", "alflib", or even
"alfabits" (pun on US cereal name) would all be better names for this
library.

Actually, now that I'm seeing on screen, I like alfabits :).
--
"The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline>
The Terminals Wiki <http://terminals-wiki.org>
The Computer Graphics Museum <http://computergraphicsmuseum.org>
Legalize Adulthood! (my blog) <http://legalizeadulthood.wordpress.com>
0 new messages