Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

If loving linux is wrong, I dont wanna be right. -- Topic for #LinuxGER


devel / comp.lang.ada / Re: 2-dimensional view on 1 dimensional array

SubjectAuthor
* Re: 2-dimensional view on 1 dimensional arrayMarek
+- Re: 2-dimensional view on 1 dimensional arrayJ-P. Rosen
`- Re: 2-dimensional view on 1 dimensional arrayAdaMagica

1
Re: 2-dimensional view on 1 dimensional array

<tj94l2$238d3$2@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=8964&group=comp.lang.ada#8964

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!paganini.bofh.team!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: ficorax@gmail.com (Marek)
Newsgroups: comp.lang.ada
Subject: Re: 2-dimensional view on 1 dimensional array
Date: Tue, 25 Oct 2022 18:59:14 +0200
Organization: A noiseless patient Spider
Lines: 89
Message-ID: <tj94l2$238d3$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 25 Oct 2022 16:59:14 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="6825831ce1a782b2e8a677446fc70dd8";
logging-data="2204067"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18y40h8K+vYJI41wCmr4pzV"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.2.2
Cancel-Lock: sha1:7VByJ/LxNDb6IPfMeFADjNPXYWw=
Content-Language: en-US
 by: Marek - Tue, 25 Oct 2022 16:59 UTC

I want just to know if it is possible to make different "view" on 1
dimensional array. And of course I meant not 2-dimensional array but
array of arrays. Reason for that is that I want to use slicing on that view.

Ok, here is full specification:

generic
type T is private;
type T_Array is array (Natural range <>) of aliased T;
type T_Array_Access is access all T_Array;
package Buffers is

type Row_Array is array (Natural range <>) of aliased
T_Array_Access;

type Row_Array_Access is access all Row_Array;

type Buffer is tagged
record
Raw_Buffer : T_Array_Access := null;
Rows_Table : Row_Array_Access := null;
Rows : Natural := 0;
Columns : Natural := 0;
Step : Integer := 0;
Max_Rows : Natural := 0;
end record;

procedure Init
(This : in out Buffer;
Buffer : T_Array_Access;
Rows : Natural;
Columns : Natural;
Step : Integer);

procedure Set_Value
(This : in out Buffer;
Value : T);

function Get_Buffer
(This : Rendering_Buffer)
return T_Array_Access
is (This.Buffer);

function Get_Rows_Table
(This : Rendering_Buffer)
return Row_Array_Access
is (This.Rows);

function Get_Columns
(This : Rendering_Buffer)
return Natural
is (This.Columns);

function Get_Rows
(This : Rendering_Buffer)
return Natural
is (This.Rows);

function Get_Step
(This : Rendering_Buffer)
return Integer
is (This.Step);

function Move_Start
(This : Rendering_Buffer;
Col_Offset : Natural;
Row_Offset : Natural)
return T_Array_Access;

function Row
(This : Rendering_Buffer;
R : Natural)
return T_Array_Access;

procedure Copy_From
(This : in out Rendering_Buffer;
Source : Rendering_Buffer);

end Buffers;

I consider this package to be a kind of template that I can apply to the
raw data and get what it expects. That is why I am using access types.
I know this is very C-ish but...

thank you for your answers everybody
Marek
p.s. Be aware that this group is read not only by software engineers.
Carpenters may also happen ... :)

Re: 2-dimensional view on 1 dimensional array

<tjasqg$2dlea$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=8967&group=comp.lang.ada#8967

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!aioe.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: rosen@adalog.fr (J-P. Rosen)
Newsgroups: comp.lang.ada
Subject: Re: 2-dimensional view on 1 dimensional array
Date: Wed, 26 Oct 2022 10:57:53 +0200
Organization: Adalog
Lines: 16
Message-ID: <tjasqg$2dlea$1@dont-email.me>
References: <tj94l2$238d3$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 26 Oct 2022 08:57:52 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="9d3d8aeb199c19c7292ba03af9a62abb";
logging-data="2545098"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/g4XCgzx4RAQyRAmu/xQIw"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.4.0
Cancel-Lock: sha1:zDgmI890e9sIXxfaSSm9gSPFpDY=
Content-Language: fr
In-Reply-To: <tj94l2$238d3$2@dont-email.me>
 by: J-P. Rosen - Wed, 26 Oct 2022 08:57 UTC

Le 25/10/2022 à 18:59, Marek a écrit :
> I want just to know if it is possible to make different "view" on 1
> dimensional array. And of course I meant not 2-dimensional array but
> array of arrays. Reason for that is that I want to use slicing on that
> view.
Any one dimensional array can be sliced. If you have an (1 dimensional)
array of arrays, it can be sliced, as well as any of its components.
Still puzzled about what you want to achieve (and the depth of your
pointers-to-pointers-to-pointers....)

--
J-P. Rosen
Adalog
2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX
https://www.adalog.fr https://www.adacontrol.fr

Re: 2-dimensional view on 1 dimensional array

<9dadc13d-3bda-4166-9e24-6634d36255ean@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=8971&group=comp.lang.ada#8971

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:ac8:7d42:0:b0:39c:dd3f:b74d with SMTP id h2-20020ac87d42000000b0039cdd3fb74dmr37022637qtb.279.1666796916806;
Wed, 26 Oct 2022 08:08:36 -0700 (PDT)
X-Received: by 2002:ac8:7d49:0:b0:399:d201:840b with SMTP id
h9-20020ac87d49000000b00399d201840bmr37619460qtb.309.1666796916479; Wed, 26
Oct 2022 08:08:36 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Wed, 26 Oct 2022 08:08:36 -0700 (PDT)
In-Reply-To: <tj94l2$238d3$2@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=94.31.101.23; posting-account=rmHyLAoAAADSQmMWJF0a_815Fdd96RDf
NNTP-Posting-Host: 94.31.101.23
References: <tj94l2$238d3$2@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <9dadc13d-3bda-4166-9e24-6634d36255ean@googlegroups.com>
Subject: Re: 2-dimensional view on 1 dimensional array
From: christ-usch.grein@t-online.de (AdaMagica)
Injection-Date: Wed, 26 Oct 2022 15:08:36 +0000
Content-Type: text/plain; charset="UTF-8"
 by: AdaMagica - Wed, 26 Oct 2022 15:08 UTC

ficorax@gmail.com schrieb am Dienstag, 25. Oktober 2022 um 18:59:15 UTC+2:
> I want just to know if it is possible to make different "view" on 1
> dimensional array. And of course I meant not 2-dimensional array but
> array of arrays. Reason for that is that I want to use slicing on that view.
>
> Ok, here is full specification:
> generic
> type T is private;
> type T_Array is array (Natural range <>) of aliased T;
> type T_Array_Access is access all T_Array;
> package Buffers is

and so on ununderstandably.
Have you ever heard of something like comments? Or more fundamentally, of design? This is just a lump of code fragments hurting my brain.


devel / comp.lang.ada / Re: 2-dimensional view on 1 dimensional array

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor