Deutsch   English   Français   Italiano  
<c3d74ebf-7153-4eb2-a22d-72b7c77ecf0bn@googlegroups.com>

View for Bookmarking (what is this?)
Look up another Usenet article

X-Received: by 2002:a05:6214:b29:b0:650:304:5137 with SMTP id w9-20020a0562140b2900b0065003045137mr17198qvj.12.1693358164167;
        Tue, 29 Aug 2023 18:16:04 -0700 (PDT)
X-Received: by 2002:a63:9250:0:b0:565:e2cd:c9df with SMTP id
 s16-20020a639250000000b00565e2cdc9dfmr115447pgn.10.1693358163705; Tue, 29 Aug
 2023 18:16:03 -0700 (PDT)
Path: ...!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: fr.comp.lang.ada
Date: Tue, 29 Aug 2023 18:16:03 -0700 (PDT)
In-Reply-To: <uclnsh$fii$1@shakotay.alphanet.ch>
Injection-Info: google-groups.googlegroups.com; posting-host=2a02:1210:2e90:8100:318d:13f0:4c99:fb57;
 posting-account=gRqrnQkAAAAC_02ynnhqGk1VRQlve6ZG
NNTP-Posting-Host: 2a02:1210:2e90:8100:318d:13f0:4c99:fb57
References: <uclnsh$fii$1@shakotay.alphanet.ch>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <c3d74ebf-7153-4eb2-a22d-72b7c77ecf0bn@googlegroups.com>
Subject: =?UTF-8?B?UmU6IFF1ZXN0aW9uIGRlIGfDqW7DqXJpY2l0w6k=?=
From: Gautier write-only address <gautier_niouzes@hotmail.com>
Injection-Date: Wed, 30 Aug 2023 01:16:04 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Bytes: 2708
Lines: 48

J'ai ajout=C3=A9 qqes param=C3=A8tres formels:
with Interfaces.C;

procedure genconv is

use Interfaces.C;

type char_array is array (size_t range <>) of aliased char;=20

--  subtype t_TW_STR32 is char_array (1 .. 34);
--  subtype t_TW_STR64 is char_array (1 .. 66);
--  subtype t_TW_STR128 is char_array (1 .. 130);
--  subtype t_TW_STR255 is char_array (1 .. 256);=20

generic
type Item_Type is private;
nul : Item_Type;
type Index_Type is mod <>;
type Array_Type is array (Index_Type range <>) of Item_Type;
with function To_Item_Type (c : Character) return Item_Type;
function To_TW_STR (Item : String) return Array_Type;

function To_TW_STR (Item : String) return Array_Type is
begin
return Result : Array_Type (1 .. Item'Length + 1) with Relaxed_Initializati=
on do
for J in Item'Range loop
Result (Index_Type (J - Item'First + 1)) :=3D To_Item_Type (Item (J));  -- =
 Was J - Item'First
end loop;
Result (Index_Type (Item'Length + 1)) :=3D nul;  --  Was Item'Last + 1
end return;
end To_TW_STR;

function To_TW_C is new To_TW_STR (char, nul, size_t, char_array, to_C);

begin
null;
end;

Variante: l'indexation de ton r=C3=A9sultat commence par 0:
....
return Result : Array_Type (0 .. Item'Length) with Relaxed_Initialization d=
o
for J in Item'Range loop
Result (Index_Type (J - Item'First)) :=3D To_Item_Type (Item (J));
end loop;
Result (Index_Type (Item'Length)) :=3D nul;
end return;