comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: unicode and wide_text_io
Date: Thu, 28 Dec 2017 12:50:32 +0100
Date: 2017-12-28T12:50:32+01:00	[thread overview]
Message-ID: <p22lq7$1r3c$1@gioia.aioe.org> (raw)
In-Reply-To: fak1iiF5at6U1@mid.individual.net

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


  reply	other threads:[~2017-12-28 11:50 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-27 18:08 unicode and wide_text_io Mehdi Saada
2017-12-27 20:04 ` Dmitry A. Kazakov
2017-12-27 21:47   ` Dennis Lee Bieber
2017-12-27 22:32 ` Mehdi Saada
2017-12-27 22:33   ` Mehdi Saada
2017-12-27 22:48     ` Mehdi Saada
2017-12-27 23:32       ` Mehdi Saada
2017-12-27 23:57   ` Randy Brukardt
2017-12-28  5:20     ` Robert Eachus
2017-12-31 21:41       ` Keith Thompson
2017-12-28  9:04   ` Dmitry A. Kazakov
2017-12-28 11:06     ` Niklas Holsti
2017-12-28 11:50       ` Dmitry A. Kazakov [this message]
2017-12-28 13:15 ` Mehdi Saada
2017-12-28 14:25   ` Dmitry A. Kazakov
2017-12-28 14:32     ` Simon Wright
2017-12-28 15:28       ` Niklas Holsti
2017-12-28 15:47         ` 00120260b
2017-12-28 22:35           ` G.B.
2017-12-28 18:15         ` Simon Wright
2017-12-28 22:36 ` Mehdi Saada
2017-12-29  0:51   ` Randy Brukardt
2017-12-30 12:50   ` Björn Lundin
2017-12-30 15:33     ` Dennis Lee Bieber
2017-12-30 15:56       ` Dmitry A. Kazakov
2017-12-30 23:20       ` Björn Lundin
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox