From: Aleksy Grabowski <hurufu@gmail.com>
Subject: Help with designing data structure for novice Ada programmer
Date: Sat, 8 Jan 2022 21:41:26 +0100 [thread overview]
Message-ID: <srcstm$1k0$1@dont-email.me> (raw)
Hi all, I'm new here.
I'm experienced embedded C developer and I've started 2 years ago an
implementation of one of the specifications kind of popular in the
payment industry. I also hope to make it open source one day.
I've implemented most of it in C, but now I have a problem, because I
have to guarantee consistency of a huge configurable data structure,
that can be changed by an entity which in theory may not be in my
control. And adding all checks quickly became nightmarish and then I've
found an Ada language.
I already did some experiments, but it doesn't look right, because my
experience in Ada is around 1 week. And I want to quickly assess if it
is worth doing at all.
So my requirements:
1. Important: Syntax to accessing, setting, comparing, allocating
values should be as simple as possible, because the body of code is
generated from diagrams and it should be understandable by a non
programmer, ie payments expert. In C I've wrote some macros for it.
2. Memory management should be unobtrusive to the visual look of
diagrams. In C I've used a memory pool, so I just have to do a
single de-allocation after each transaction.
3. It should support optional, mandatory and conditional fields. In C
modeled as pointers.
4. It should support bit fields that may have different meaning if some
flag is set (in C a union of bitfields)
5. Consistency between elements, if a particular flag is set to True
then some other fields must have a certain value as well. Probably
doable by Dynamic_Predicate.
6. Data elements should be accessible by name `db.processingStatus' or
by it's tag value like `db (16#CA#)' and also it should support any
additional tag that can be supplied by the card, even if its
symbolic name isn't known (in C it's void*).
7. I have to guarantee consistency of a different views of the same
value eg. amount represented as BCD array – usual representation
or 32 bit unsigned integer when requested by tag 16#81#.
8. It should be possible to modify data elements both symbolically or
using binary arrays with encoded data. Either because it is
specified this way or I have to set it to the unspecified value. In
C I've achieved this by having a union of char[] and a bitfield.
9. And as a bonus it should be serializable to EMV's variant of TLV
which isn't the same as you have in ASN.1, because EMV specification
was standardized before ASN.1 BER and those committees had little to
no cooperation.
I'm asking Ada wizards if it is at all doable in Ada? Or maybe some
links to opensource project where something similar was already achieved
so I can look it up?
--
Best Regards,
Alex
P.S. My code is available on github if someone is interested.
next reply other threads:[~2022-01-08 20:41 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-08 20:41 Aleksy Grabowski [this message]
2022-01-09 2:36 ` Help with designing data structure for novice Ada programmer Paul Rubin
2022-01-09 9:49 ` Aleksy Grabowski
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