comp.lang.ada
 help / color / mirror / Atom feed
From: Aleksy Grabowski <hurufu@gmail.com>
Subject: Re: Help with designing data structure for novice Ada programmer
Date: Sun, 9 Jan 2022 10:49:35 +0100	[thread overview]
Message-ID: <sreb3f$g0e$1@dont-email.me> (raw)
In-Reply-To: <87sftx1vpd.fsf@nightsong.com>

First of all thanks for an answer.

On 1/9/22 03:36, Paul Rubin wrote:
> Can you say what specification it is?

Yeah sure, it's called nexo. It is an open specification and it is
available for free after a registration on nexo-standards.org. It is
basically a high level description of an abstract payment terminal. They
specify all the data structures and full flow of control. Basically they
try to combine all EMV books and all regional payment schemes into a one
huge beast, to make a universal terminal.

> It sounds like you waht to define a datatype for this structure, with
> access and update procedures (OOP is not necessary but it's the same
> idea) that make sure all the rules are followed.  Is there more to it
> than that?

Something more. The first thing is update procedures, Right now I have
two modules trusted and non-trusted. Trusted part just does whatever it
wants to and non-trusted uses geters and setters. But the other thing is
that I want to model data as close to the spec as possible, so if it is
set to update some enum to a value 16#3F00# I do this. The another part
is because they tried to unify the whole payment zoo into single spec
there a lot of bizarre things there.

I also have some concrete question, how to properly implement optional
element? Right now I have something like this:

     generic
         type T is private;
     package TypeUtils is
         type Optional(exists : Boolean) is
         record
             case exists is
                 when True => value : T;
                 when False => null;
             end case;
         end record;
     end TypeUtils;

But it looks like it doesn't work, because it depends on the 
discriminant `exists' but it is set once in .ads file and I can't modify
it in runtime.

> Ada sounds like a reasonable choice, C sounds terrible, other
> possibilities depend on the hardware and software environment.  Would
> this have to run on a smart card cpu or anything like that?

Not really, arm CPU is enough. The one I have is MAX32590. I'm also not
really worried about memory consumption. Those embedded platforms have a
plenty of RAM nowadays.

How large this project can be? I'm already two years into it :)

  reply	other threads:[~2022-01-09  9:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-08 20:41 Help with designing data structure for novice Ada programmer Aleksy Grabowski
2022-01-09  2:36 ` Paul Rubin
2022-01-09  9:49   ` Aleksy Grabowski [this message]
2022-01-09 10:10     ` Dmitry A. Kazakov
2022-01-14  5:01   ` 1.AAC0832
2022-01-14 16:05     ` Dennis Lee Bieber
2022-01-14 17:40       ` Dmitry A. Kazakov
replies disabled

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