From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: unicode and wide_text_io Date: Thu, 28 Dec 2017 12:50:32 +0100 Organization: Aioe.org NNTP Server Message-ID: References: NNTP-Posting-Host: TliDXSPe+gBSGCqP3SEJ2Q.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 Content-Language: en-US X-Notice: Filtered by postfilter v. 0.8.2 Xref: reader02.eternal-september.org comp.lang.ada:49672 Date: 2017-12-28T12:50:32+01:00 List-Id: On 2017-12-28 12:06, Niklas Holsti wrote: > On 17-12-28 11:04 , Dmitry A. Kazakov wrote: >> On 2017-12-27 23:32, Mehdi Saada wrote: >    [snip] >>> Superscripts and subscripts means more change in the IO package. >>> Before I could simply use the generic Integer_IO, but I have no clue >>> how to do to output a specific code point for each digit in a >>> specific  base... wouldn't that mean rewriting part of Integer_IO ? >> >> You mean the standard library Integer_IO? Sure, you will have to replace >> it. > > It seems simpler to continue using Integer_IO, but to Put the number > into a String, and then translate the digits in the resulting String > into superscript or subscript form, as desired. Translating integer into decimal digits is arguably easier than conversion of ASCII codes for decimal digits (and sign) into UTF-8 subscript and superscript chains of octets. And the procedures and functions for sub-/superscript string I/O are ready. No need to rewrite them. BTW, Integer_IO is quite uncomfortable to use with strings. This was the reason why I redesigned its interface as: procedure Put ( Destination : in out String; Pointer : in out Integer; Value : Number'Base; Base : NumberBase := 10; PutPlus : Boolean := False; Field : Natural := 0; Justify : Alignment := Left; Fill : Character := ' ' ); instead of: procedure Put ( To : out String; Item : in Num; Base : in Number_Base := Default_Base ); which requires trimming and thus has little advantage over plain Num'Image. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de