On Mon, 18 Mar 2024 18:05:20 +0100, streaksu wrote:
> On 3/13/24 22:55, Lawrence D'Oliveiro wrote:
>
>> If you are writing code that will run as one or more server processes,
>> you will likely also want to provide scripts/config to manage those
>> processes. For systemd, that could be service definition files.
>
> ... to my understanding, that might be better managed by distribution /
> OS maintainers, rather than developers.
I was thinking more about code being written for in-house use by
particular customers--I should have made that clear.
However, what you say is true for open-source code that is being
published. Though I suspect it would still be helpful to provide some info
about how interlocking processes are supposed to fit together, and
systemd .service files could serve as a lingua franca for that, even for
distros that don’t use systemd. The declarative systemd unit-file syntax
should be easier to translate to other forms than perhaps going the other
way.
On 3/13/24 22:55, Lawrence D'Oliveiro wrote:
> If you are writing code that will run as one or more server processes, you
> will likely also want to provide scripts/config to manage those processes.
> For systemd, that could be service definition files.
Not relevant to the whole overarching discussion, but to my
understanding, that might be better managed by distribution / OS
maintainers, rather than developers. When thinking about programs like
daemons, or other similar pieces on a bigger system, with all the
variety of systems, init systems, and programs around, who best to do it
than the people that are ultimately orchestrating the whole ecosystem.
Hello everybody! I would like to announce the April (2024) Ada Monthly Meetup which will be taking place on the 6th of April at **13:00 UTC time (15:00 CEST)**. As always the meetup will take place over at Jitsi. The Meetup will also be livestreamed to Youtube. If someone would like to propose a talk or a topic, feel free to do so! We currently have no topics :wink: Though I will try to focus more on Ada and I would like to bring people's attention to [Tsoding's Ada livestreams](https://forum.ada-lang.io/t/making-a-game-in-ada-with-raylib/704). Here are the connection details from previous posts: The meetup will take place over at Jitsi, a conferencing software that runs on any modern browser. The link is [Jitsi Meet ](https://meet.jit.si/AdaMonthlyMeetup) The room name is “AdaMonthlyMeetup” and in case it asks for a password, it will be set to “AdaRules”. I do not want to set up a password, but in case it is needed, it will be the one above without the quotes. The room name is generally not needed as the link should take you directly there, but I want to write it down just in case someone needs it. Best regards and see you soon! Fer P.S: it is that time of year when clocks have their time changed. So please, take a look at whether this affects you. (Central) Europe will now go from CET to CEST, so +2h. USA and related countries already had heir time changed last week.
On Wed, 13 Mar 2024 16:34:14 +0200, magardner2010 wrote:
> So, unless one is writing software that directly interacts with the init
> system ...
If you are writing code that will run as one or more server processes, you
will likely also want to provide scripts/config to manage those processes.
For systemd, that could be service definition files.
Hello, > Ada-compiler makers used to target Red Hat and different Adaists used > to > contribute to Debian. > > Red Hat and Debian use disputed SystemD C code. Do you avoid it? Well as all new stuff... People like bashing. If one think systemd is not good he can propose something better. Bashing people/projects seems a way of life for some. This has been also the case for pulseaudio and remember the new GNOME Shell at the begin... just to mention those as examples. That a non issue to me... -- Pascal Obry / Magny Les Hameaux (78) The best way to travel is by means of imagination http://photos.obry.net gpg --keyserver keys.gnupg.net --recv-key F949BD3B
Nioclás Pól Caileán de Ghloucester
<Master_Fontaine_is_dishonest@Strand_in_London.Gov.UK> writes:
> On Wed, 13 Mar 2024, MAGardner2010 wrote:
> "I'm pretty sure that the presence or absence of SystemD doesn't, [. . .]
> influence how compilers work."
>
> Hello,
>
> I agree.
>
> "[. . .] it shouldn't matter if one is programming on/for Debian,
> Devuan, Arch, Fedora, Red Hat, or possibly even one of the BSDs."
>
> GNU/Linux users debate about SystemD allegedly being buggy and
> insecure. Contributors to GNU/Linux distributions boast that such
> distributions do not use SystemD because of these reasons. A new
> GNU/Linux distribution was created specifically to avoid SystemD. I do
> not want to use (Ada-compiler) software on a buggy or insecure
> operating system. Do you?
All operating systems are buggy and insecure. Some are less so than
others. I have no particular opinion on whether systemd makes a system
more or less secure. (The system I'm typing this on happens to use
systemd, a fact that I routinely ignore.)
If you prefer to avoid systemd, that's fine, but I don't see the
relevance to Ada.
--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Medtronic
void Void(void) { Void(); } /* The recursive call of the void */
[-- Attachment #1: Type: text/plain, Size: 725 bytes --] On Wed, 13 Mar 2024, MAGardner2010 wrote: "I'm pretty sure that the presence or absence of SystemD doesn't, [. . .] influence how compilers work." Hello, I agree. "[. . .] it shouldn't matter if one is programming on/for Debian, Devuan, Arch, Fedora, Red Hat, or possibly even one of the BSDs." GNU/Linux users debate about SystemD allegedly being buggy and insecure. Contributors to GNU/Linux distributions boast that such distributions do not use SystemD because of these reasons. A new GNU/Linux distribution was created specifically to avoid SystemD. I do not want to use (Ada-compiler) software on a buggy or insecure operating system. Do you? Regards. Caileán Nioclás Pól de Ghloucester
On 13/03/2024 16:07, Nioclás Pól Caileán de Ghloucester wrote:
> Hello.
>
> Ada-compiler makers used to target Red Hat and different Adaists used to
> contribute to Debian.
>
> Red Hat and Debian use disputed SystemD C code. Do you avoid it?
>
> Regards.
> Nioclás Caileán Pól de Ghloucester
I'm pretty sure that the presence or absence of SystemD doesn't, or at
least shouldn't, influence how compilers work.
So, unless one is writing software that directly interacts with the init
system, or any of the other components that SystemD provides (and are
not yet available in other init systems), it shouldn't matter if one is
programming on/for Debian, Devuan, Arch, Fedora, Red Hat, or possibly
even one of the BSDs.
[-- Attachment #1: Type: text/plain, Size: 224 bytes --] Hello. Ada-compiler makers used to target Red Hat and different Adaists used to contribute to Debian. Red Hat and Debian use disputed SystemD C code. Do you avoid it? Regards. Nioclás Caileán Pól de Ghloucester
In article <ushvqa$2ctsj$1@dont-email.me>, Fernando Oleo / Irvise <irvise_ml@irvise.xyz> wrote: >- The [NSA published a list of memory safe >languages](https://www.cisa.gov/sites/default/files/2023-12/The-Case-for-Memory-Safe-Roadmaps-508c.pdf) > - Ada was not mentioned in the list of programming languages. >Nonetheless Ada/SPARK are listed in the references. > - Ada needs better visibility and "marketing". But there's an NSA report on the same topic that lists 9 memory-safe languages, and Ada is included. See "The NSA list of memory-safe programming languages has been updated - ReadWrite" at <https://readwrite.com/the-nsa-list-of-memory-safe-programming-languages-has-been-updated/>. After some searching I found that NSA report at <https://media.defense.gov/2023/Apr/27/2003210083/-1/-1/0/CSI_SOFTWARE_MEMORY_SAFETY_V1.1.PDF>. Dirk
[Text formatted in Markdown style, I know it is not optimal for C.L.A] The March 2024 Meetup just finished! Thanks to everybody who participated. Quite a few topics were discussed, here is a list of topics and references to them: - WolfSSL and its Ada binding - [Announcement](https://www.wolfssl.com/announcing-ada-binding-to-the-wolfssl-library/) - [Initial commit, SPARK included!](https://github.com/wolfSSL/wolfssl/pull/6605) - [Build as a library, PR currently open](https://github.com/wolfSSL/wolfssl/pull/7303) - WolfSSL created the binding to "create" demand. The Ada community can help raise awareness of these tools and create a symbiotic relationship with companies and people invested in Ada. - [FOSDEM](https://fosdem.org/2024/) - [Ada Developer Workshop](http://www.ada-europe.org/conference2024/adadev.html) taking place in Barcelona the 14th of June. - The (current) submission deadline for presentations is the 31st of March! - Online participation is expected. We will try and have a setup to let people participate online! - It was created in order to let the wider Ada community have a home to meet and talk about Ada. This is a "response" to the lack of an Ada DevRoom @ FOSDEM the past couple of years. - [Alire v2.0 is around the corner](https://forum.ada-lang.io/t/ada-monthly-meeting/384/30) - Help test the new [Release Candidate 1](https://github.com/alire-project/alire/releases) - Mac M1 (ARM64) support is in the works. Thanks Simon and Maxim! - There is now a list of [projects to work on](https://ada-lang.io/docs/projects-to-work-on/) in the main Ada-Lang webpage. - It focuses of projects that would help the wider Ada community. - [Ada support for org-mode code blocks (babel) is now going to be part of the official org-mode distribution of Emacs!](https://list.orgmode.org/orgmode/87cyskn7xa.fsf@localhost/T/#mb5774149b4b90712e4bccc0f936ebbbbe138e065) - Thanks Francesc for the work! - The [NSA published a list of memory safe languages](https://www.cisa.gov/sites/default/files/2023-12/The-Case-for-Memory-Safe-Roadmaps-508c.pdf) - Ada was not mentioned in the list of programming languages. Nonetheless Ada/SPARK are listed in the references. - Ada needs better visibility and "marketing". - The GCC 14's Ada changelog section is on its way, stay tuned! See you in one month (more or less)! Regards, Fer
On 2024-03-07 15:54, Simon Wright wrote:
> Simon Wright <simon@pushface.org> writes:
>>
>> See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113979
>
> And now fixed on all "active" branches! (that's 11, 12, 13 & master,
> judging by the comments)
>
> Of course, it takes a while for this to percolate through to a release.
Cool. Thanks for reporting this.
--
Jeff Carter
"C's solution to this [variable-sized array parameters] has real
problems, and people who are complaining about safety definitely
have a point."
Dennis Ritchie
25
Simon Wright <simon@pushface.org> writes:
> "Jeffrey R.Carter" <spam.jrcarter.not@spam.acm.org.not> writes:
>
>> On 2024-02-18 10:59, Simon Wright wrote:
>>> Oh, you didn't say that -gnata is needed to provoke the error,
>>> though
>>> it's not really a surprise.
>>> Now, only GCC 11.2.0 doesn't have the error; so it's a regression in
>>> GCC
>>> 12.
>>
>> Sorry, I should have given my compilation options. You're right that I
>> used -gnata. But I did say it was related to the Dynamic_Predicate.
>>
>> As you have GNAT 14 and I don't, perhaps it would be best for you to
>> report this.
>
> See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113979
And now fixed on all "active" branches! (that's 11, 12, 13 & master,
judging by the comments)
Of course, it takes a while for this to percolate through to a release.
Dear all, this is just a quick reminder that the next Ada Monthly Meetup will take place on Saturday 9th of March! No topics were proposed for this meetup. Nonetheless, I will take the opportunity to talk a bit about FOSDEM (and WolfSSL), the newly proposed Ada Developer Workshop during AEiC, remind people about the newly released Alire v2.0-RC1 and a few other topics if we have time. Best regards, Fer
That sounds amazing! Thank you so much for your work and to the people at AEiC for making it happen. > The cost will be lower than for the main conference. Our goal is to > make it completely free, just like FOSDEM, but this is still a > Work-In-Progress (WIP). That would be a huge deal. I have not checked this edition's registrations, but if 2023's are anything to go by, as a hobbyist Ada developer, I don't think I can justify it for myself. But a cheaper event would be a great alternative. Please do keep us updated!
On 2024-02-25 13:23, Blady wrote:
> Le 24/02/2024 à 11:39, Niklas Holsti a écrit :
>> The point of these examples (which are only in the discussion
>> annotation, not in the normative standard) is to discuss what is
>> syntactically legal and why. The examples need not make practical sense.
>
> Well, despite I knew that, I wanted to draw some use cases from them.
> For instance:
> A : A_Tagged := (Some_Tagged'(raise TBD_Error) with Comp => 'A');
> It will raise TBD_Error if Some_Tagged is not a null record, good to
> know, isn't it?
Hm, not raising the exception for a null record seems weird to me, and I
cannot deduce it from the RM. Moreover, for a plain qualified expression
Some_Tagged'(raise TBD_Error)
not in an extension aggregate GNAT raises the exception even if the type
is a null record. I suspect that not raising the exception for an
extension aggregate where the ancestor type is a null record is a bug in
GNAT.
Le 24/02/2024 à 11:39, Niklas Holsti a écrit :
> The point of these examples (which are only in the discussion
> annotation, not in the normative standard) is to discuss what is
> syntactically legal and why. The examples need not make practical sense.
Well, despite I knew that, I wanted to draw some use cases from them.
For instance:
A : A_Tagged := (Some_Tagged'(raise TBD_Error) with Comp => 'A');
It will raise TBD_Error if Some_Tagged is not a null record, good to
know, isn't it?
Pascal.
Le 24/02/2024 à 11:39, Jeffrey R.Carter a écrit : > On 2024-02-24 10:50, Blady wrote: >> >> My guess: whatever the size of Some_Array (greater than 3), B is >> elaborated but raises Not_Valid_Error when accessing component beyond >> position 3: >> >> type Some_Array is array (Positive range 1..10) of Natural; >> ... >> B : Some_Array := (1, 2, 3, others => raise Not_Valid_Error); >> ... >> begin >> X := B (2); -- OK >> X := B (6); -- raises Not_Valid_Error >> end; >> >> Is it correct? > > No. This will raise the exception upon the elaboration of B. > > The only use of this that I can imagine is if the length of Some_Array > is 3. Then the others choice is null, so the raise expression is never > evaluated. But if someone changes the definition of Some_Array to be > longer, then the exception will be raised. If I understand well, no compiler error nor warning at compilation time but Not_Valid_Error raised at run time elaboration. To be compared with: B1 : Some_Array := (1, 2, 3); No compiler error, one compiler warning "Constraint_Error will be raised at run time" and Constraint_Error range check failed raised at run time elaboration. >> NB: GNAT 13.2 issues a compilation error: >> >>> error: "others" choice not allowed here >> see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113862 > > The example in the error report has Some_Array unconstrained, in which > case an others choice is not allowed. With the constrained definition > given above, the aggregate is valid. Thanks to point out, I've corrected the GNAT report. Pascal.
Dear Ada community, I come with great news! For the past two years, there was no Ada DevRoom over @ FOSDEM, a place where the Ada community used to meet and share their work and projects. Some of us wanted to keep having such experience as we believed it to be a greatly beneficial aspect to the wider Ada community. For this reason, Fabien Chouteau, Dirk Craeynest and Fernando Oleo Blanco, made a proposal to the Ada-Europe International Conference on Reliable Software Technologies (AEiC 2024 aka Ada-Europe 2024) in order to have a “devroom” for the wider Ada community, just like in FOSDEM. We were accepted and you can already find all the information over at the Ada Developer Workshop webpage [1]! I would encourage everybody to take a look at it! Nonetheless, here is a quick summary highlighting some of the points: - It will take place on Friday, 14th of June in Barcelona. Friday was chosen in order to minimise the amount of free days/holidays that we would need to take off from our jobs and allow us to then use the weekend to visit and enjoy Barcelona. - The cost will be lower than for the main conference. Our goal is to make it completely free, just like FOSDEM, but this is still a Work-In-Progress (WIP). - The nature of the event is similar to any past DevRoom that took place @ FOSDEM. The main difference is that now, being an open-source project will not be a requirement. - March 31st, 2024 is the (current) deadline for submissions. If you would like to present your work or discuss topics, please, please please, keep this date in mind! We are eager to hear from all of you. And if you have any questions, please, let us know! [1] https://www.ada-europe.org/conference2024/adadev.html Best regards, Fer
On 2024-02-24 11:50, Blady wrote: > Hello, > > AARM Ada 2022 section 11.3 presents some uses of raise expressions > including this one: > (http://www.ada-auth.org/standards/22aarm/html/AA-11-3.html) > > 2.a.10/4 ... > > B : Some_Array := (1, 2, 3, others => raise > Not_Valid_Error); > > What could be the use cases? The point of these examples (which are only in the discussion annotation, not in the normative standard) is to discuss what is syntactically legal and why. The examples need not make practical sense. > My guess: whatever the size of Some_Array (greater than 3), B is > elaborated but raises Not_Valid_Error when accessing component beyond > position 3: No. A raise-expression is not a value that can be stored in an array or passed around; its evaluation raises an exception /instead/ of yielding a value. In this example, if the evaluation of the array aggregate that initializes B evaluates the expression supplied for the "others" choice, this evaluation will raise Not_Valid_Error and disrupt the initialization of B. It is not clear to me if the RM requires the evaluation of the "others" expression if there are no "other" indices. Experimenting with GNAT (Community 2019) shows that if the Some_Array type has 'Length = 3, the exception is not raised (so the "others" value is not evaluated), while if the 'Length is greater than 3 the exception is raised. > type Some_Array is array (Positive range 1..10) of Natural; > ... > B : Some_Array := (1, 2, 3, others => raise Not_Valid_Error); That should raise Not_Valid_Error during the initialization of B. > ... > begin > X := B (2); -- OK > X := B (6); -- raises Not_Valid_Error > end; > > Is it correct? No. > > NB: GNAT 13.2 issues a compilation error: > >>> error: "others" choice not allowed here > see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113862 Interesting. GNAT Community 2019 accepted it.
On 2024-02-24 10:50, Blady wrote: > > My guess: whatever the size of Some_Array (greater than 3), B is elaborated but > raises Not_Valid_Error when accessing component beyond position 3: > > type Some_Array is array (Positive range 1..10) of Natural; > ... > B : Some_Array := (1, 2, 3, others => raise Not_Valid_Error); > ... > begin > X := B (2); -- OK > X := B (6); -- raises Not_Valid_Error > end; > > Is it correct? No. This will raise the exception upon the elaboration of B. The only use of this that I can imagine is if the length of Some_Array is 3. Then the others choice is null, so the raise expression is never evaluated. But if someone changes the definition of Some_Array to be longer, then the exception will be raised. > NB: GNAT 13.2 issues a compilation error: > >>> error: "others" choice not allowed here > see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113862 The example in the error report has Some_Array unconstrained, in which case an others choice is not allowed. With the constrained definition given above, the aggregate is valid. -- Jeff Carter "Gentlemen, you can't fight in here. This is the War Room!" Dr. Strangelove 30
Hello, AARM Ada 2022 section 11.3 presents some uses of raise expressions including this one: (http://www.ada-auth.org/standards/22aarm/html/AA-11-3.html) 2.a.10/4 ... B : Some_Array := (1, 2, 3, others => raise Not_Valid_Error); What could be the use cases? My guess: whatever the size of Some_Array (greater than 3), B is elaborated but raises Not_Valid_Error when accessing component beyond position 3: type Some_Array is array (Positive range 1..10) of Natural; ... B : Some_Array := (1, 2, 3, others => raise Not_Valid_Error); ... begin X := B (2); -- OK X := B (6); -- raises Not_Valid_Error end; Is it correct? NB: GNAT 13.2 issues a compilation error: >>> error: "others" choice not allowed here see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113862 Thanks, Pascal.
On Thu, 22 Feb 2024 09:54:07 +0100, Dmitry A. Kazakov wrote: > On 2024-02-21 20:44, Lawrence D'Oliveiro wrote: > >> Think of a stream of bytes as the ultimate meta-format. > > Of course not. It is not a format it is a transport layer. > [ BTW, it is not bytes, it is octets actually ] We normally work with bytes here. And your “transport layer” is what gets the bytes from one place to another. So my point still stands: the bytestream is the ultimate lowest-level meta-format. > Implementation of serialization/deserialization on top of > JSON is exponentially harder than on top of an octet stream. We already have libraries for doing that, at least for byte streams. That’s why it’s so much easier to build on top of those, rather than going back to bytes every time. As for octets--I guess you’re on your own. > Alone specification of handling missing, superfluous, wrongly typed > fields is a huge work before a single line of code is written. All the code for that already exists, in most if not all common languages. > 5. JSON cannot specify constraints, like value ranges, precision, > variable record fields, array bounds. Those are specific to the format you are building on top of the meta- format. > 6. JSON has no means of reflection. Again, this is specific to the format. For an example of how you can do this, see Varlink <https://varlink.org/>.
On 2024-02-21 20:44, Lawrence D'Oliveiro wrote: > On Wed, 21 Feb 2024 08:43:13 +0100, Dmitry A. Kazakov wrote: > >> On 2024-02-20 23:32, Lawrence D'Oliveiro wrote: >>> On Tue, 20 Feb 2024 21:45:46 +0100, Dmitry A. Kazakov wrote: >>> >>>> The burden of checks is moved to the application, the format is same. >>> >>> Isn’t that how all formats are implemented? >> >> There is a difference in semantics of checks. > > Think of a stream of bytes as the ultimate meta-format. Of course not. It is not a format it is a transport layer. [ BTW, it is not bytes, it is octets actually ] > All extra layout > on top of that is “moved to the application”, as you say. But it just > takes more work starting from such a low level; starting from a higher > point, like JSON, reduces that work. Not at all. Implementation of serialization/deserialization on top of JSON is exponentially harder than on top of an octet stream. Alone specification of handling missing, superfluous, wrongly typed fields is a huge work before a single line of code is written. Furthermore, 1. JSON is unable to represent basic data, like time stamps. These must be encoded as strings accompanied with parsing and checks. Compare that with encoding as octets. 2. JSON is not extensible in any sense. You cannot add new syntax elements to JSON. 3. There is no any abstraction by which you could reuse JSON encoding. I.e. this element is like that element. Repeat this by number of times specified by that. 4. Nor JSON supports extensions objects. Compare it with Ada's extension aggregates: http://ada-auth.org/standards/rm12_w_tc1/html/RM-4-3-2.html#I2535 5. JSON cannot specify constraints, like value ranges, precision, variable record fields, array bounds. 6. JSON has no means of reflection. Talking about "metas", there is no way to convey a JSON description of an object (rather than instance = data) to another node. Both sides must know each other prior to communication. I don't say that dynamic binding is a good idea for communication for for tall claims made and all immense overhead involved... JSON is an extremely crude primitive hobbyish idea a lazy undergraduate in horticulture might have about a communication protocol... (:-)) -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
On Wed, 21 Feb 2024 08:43:13 +0100, Dmitry A. Kazakov wrote:
> On 2024-02-20 23:32, Lawrence D'Oliveiro wrote:
>> On Tue, 20 Feb 2024 21:45:46 +0100, Dmitry A. Kazakov wrote:
>>
>>> The burden of checks is moved to the application, the format is same.
>>
>> Isn’t that how all formats are implemented?
>
> There is a difference in semantics of checks.
Think of a stream of bytes as the ultimate meta-format. All extra layout
on top of that is “moved to the application”, as you say. But it just
takes more work starting from such a low level; starting from a higher
point, like JSON, reduces that work.
On 2024-02-20 23:32, Lawrence D'Oliveiro wrote: > On Tue, 20 Feb 2024 21:45:46 +0100, Dmitry A. Kazakov wrote: > >> The burden of checks is moved to the application, the format is same. > > Isn’t that how all formats are implemented? There is a difference in semantics of checks. The checks below and above the OSI level of the format are outside the scope of format. One thing is to check a string against a database of client names and another to check its length or validity of UTF-8 encoding. Do you check ASCII characters? No, because they are densely encoded. If error-correction etc is needed it is added below. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
On Tue, 20 Feb 2024 21:45:46 +0100, Dmitry A. Kazakov wrote:
> The burden of checks is moved to the application, the format is same.
Isn’t that how all formats are implemented?
On 2024-02-20 20:37, Lawrence D'Oliveiro wrote: > On Tue, 20 Feb 2024 09:55:30 +0100, Dmitry A. Kazakov wrote: > >> On 2024-02-20 01:41, Lawrence D'Oliveiro wrote: >> >>> On Mon, 19 Feb 2024 09:32:42 +0100, Dmitry A. Kazakov wrote: >>> >>>> You did not say why JSON is needed. >>> >>> Because it’s such a convenient meta-format, >> >> Meta of what? > > You don’t understand the concept of “meta-formats”? Nope. The meaning of the word "meta" is having an object made out of entities operating some other objects. E.g. meta-language vs object language, metadata (data about data), logical inference vs logical predicates. Meta-format must represent formats rather than data. JSON is not that thing. It is just a [bad] data representation format. > Maybe you prefer > “format family” or “format superclass”. Does that help make things > clearer? No. I don't care about classifications of poorly designed formats. JSON is not a format family and a family of formats is not a meta-format. > It is something easily specialized to become an application- > specific format, with less effort than creating the specific format from > scratch. It is always the same format. JSON's inability to describe any constraints does not make it *specialized*. The burden of checks is moved to the application, the format is same. All such stupid thinks only add overhead, additional points of failure and make designing reasonable recovery logic impossible. [ It keeps me wonder. The coding theory exists more than hundred years. People are inventing square wheels made of cabbage leaves instead of taking some short course... ] > An earlier example is XML. Also IFF on the Commodore-Amiga, from the > 1980s. You can go back as far as to Hollerith specifications... (:-)) -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
On Tue, 20 Feb 2024 09:55:30 +0100, Dmitry A. Kazakov wrote:
> On 2024-02-20 01:41, Lawrence D'Oliveiro wrote:
>
>> On Mon, 19 Feb 2024 09:32:42 +0100, Dmitry A. Kazakov wrote:
>>
>>> You did not say why JSON is needed.
>>
>> Because it’s such a convenient meta-format,
>
> Meta of what?
You don’t understand the concept of “meta-formats”? Maybe you prefer
“format family” or “format superclass”. Does that help make things
clearer? It is something easily specialized to become an application-
specific format, with less effort than creating the specific format from
scratch.
An earlier example is XML. Also IFF on the Commodore-Amiga, from the
1980s.
Does that help?
On 2024-02-20 01:41, Lawrence D'Oliveiro wrote: > On Mon, 19 Feb 2024 09:32:42 +0100, Dmitry A. Kazakov wrote: > >> You did not say why JSON is needed. > > Because it’s such a convenient meta-format, Meta of what? How is it convenient for streaming objects? Begin with access type. Proceed with time stamps. > and its text basis helps with > debugging. There is nothing to debug in implementation of stream attributes. Nor it is helpful to debug communication logic issues because the format is *data representation* one. It represents *data*, not objects, not states. All vital information about the logic and state is not there. It is in the context. This is the main reason why *all* data representation formats are useless garbage even when binary. Text basis helps to produce 100 to 1 overhead in payload which directly translates into latency, network and CPU load, storage space, packet overflows, variable-length packets where it should have been fixed, chunked transfers, dynamic memory allocation and mess that makes a 64-core CPU to perform like an i286. It is absolutely useless, you cannot read, browse, search real-life gigabytes long communication logs without customized tools. Driving a car, heating the house, browsing Internet I do not care about the logs. The damn thing must work. > Its popularity aids interoperability with code bases in other > languages, A requirement does not aid anything. It is just a requirement. JSON would not aid you in dealing with X.509 certificates. They are in ASN.1. > support by existing tools, and so on and so on. Lemming's argument. Everybody's jumping I am jumping too. > If you didn’t know all that, you’ve been living under a coconut shell, as > we say in the old country ... I am pretty much aware of data representation formats. Moreover, as you may have noticed I implemented lots of them. Not because it is fun, but because communication protocols is my job. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
On Mon, 19 Feb 2024 09:39:45 +0100, Dmitry A. Kazakov wrote:
> Not Windows, It is the applications that have GUI died and files still
> open.
Files do not stay open after the processes that have them open terminate
under Linux.
Windows does seem to cling to the old VMS model of keeping things locked
down, no matter how much trouble that causes ...
On Mon, 19 Feb 2024 10:46:27 +0100, Dmitry A. Kazakov wrote:
> Firefox starts a process for each tab!
All the web browsers do nowadays. That’s the only way to maximize
isolation of potentially hostile websites.
Does that hurt performance on Windows more than it does on Linux?
On Mon, 19 Feb 2024 09:32:42 +0100, Dmitry A. Kazakov wrote:
> You did not say why JSON is needed.
Because it’s such a convenient meta-format, and its text basis helps with
debugging. Its popularity aids interoperability with code bases in other
languages, support by existing tools, and so on and so on.
If you didn’t know all that, you’ve been living under a coconut shell, as
we say in the old country ...
On 2/15/24 14:00, Nioclás Pól Caileán de Ghloucester wrote:
> Hello!
>
> It is not still 2023!
>
> With kind regards.
Ouch! True! I will make a new thread with the reminder in the next few
days ^^
Cheers,
Fer
On 19/02/2024 14:59, Björn Lundin wrote:
> On 2024-02-18 21:57, Lawrence D'Oliveiro wrote:
>> On Sun, 18 Feb 2024 12:36:54 +0100, Björn Lundin wrote:
>>
>>> On 2024-02-18 01:00, Lawrence D'Oliveiro wrote:
>>>
>>>> On Sat, 17 Feb 2024 14:36:46 +0100, DrPi wrote:
>>>>
>>>>> My usage is a bit special. The writing process writes a bunch of
>>>>> data in
>>>>> a memory buffer then requests this buffer to be transferred to another
>>>>> process by way of WM_COPYDATA.
>>>>
>>>> I thought Windows had pipes.
>>>
>>> It does,
>>> We use it for out IPC in both Linux and Windows.
>>> Works very well.
>>
>> Why doesn’t the OP use them, then?
>
> I have no idea,
>
> You can see them with
> powershell -command [System.IO.Directory]::GetFiles(\"\\.\pipe\")
>
Don't feed the troll
--
Chris
On 2024-02-18 21:57, Lawrence D'Oliveiro wrote:
> On Sun, 18 Feb 2024 12:36:54 +0100, Björn Lundin wrote:
>
>> On 2024-02-18 01:00, Lawrence D'Oliveiro wrote:
>>
>>> On Sat, 17 Feb 2024 14:36:46 +0100, DrPi wrote:
>>>
>>>> My usage is a bit special. The writing process writes a bunch of data in
>>>> a memory buffer then requests this buffer to be transferred to another
>>>> process by way of WM_COPYDATA.
>>>
>>> I thought Windows had pipes.
>>
>> It does,
>> We use it for out IPC in both Linux and Windows.
>> Works very well.
>
> Why doesn’t the OP use them, then?
I have no idea,
You can see them with
powershell -command [System.IO.Directory]::GetFiles(\"\\.\pipe\")
--
/Björn
On 2024-02-19 10:24, Björn Lundin wrote: > On 2024-02-18 21:56, Lawrence D'Oliveiro wrote: >> So why is it that Windows programs tend to avoid running multiple >> processes? > > Perhaps on win create_process is much heavier than threading compared to > unix. My suspicion only though. > > MS SQL-server use it for IPC. Firefox starts a process for each tab! The next stop is placing each one in a docker ... and, of course, HTTP for communication... The Holly Grail of modern computing is to use each available bit and each CPU tick for doing exactly nothing! (:-)) -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
On 2024-02-18 21:56, Lawrence D'Oliveiro wrote:
> So why is it that Windows programs tend to avoid running multiple processes?
Perhaps on win create_process is much heavier than threading compared to
unix. My suspicion only though.
MS SQL-server use it for IPC.
--
/Björn
On 2024-02-19 00:47, Lawrence D'Oliveiro wrote: > On Sun, 18 Feb 2024 23:10:10 +0100, Dmitry A. Kazakov wrote: > >>>> In general Windows has much richer and better API regarding >>>> interprocess communication than Linux. >>> >>> So why is it that Windows programs tend to avoid running multiple >>> processes? >> >> Because there is no need in multiple processes most of the time. Windows >> has a different philosophy and services which preclude the process orgy >> so characteristic to UNIX. For example, Windows has and collects many >> resources when a process dies. So you do not need a process monitoring >> file locks, because there is no any. > > Windows is the one that keeps files locked, *nix systems typically do not. Not Windows, It is the applications that have GUI died and files still open. If you want UNIX behavior open all files for shared I/O. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
On 2024-02-19 00:44, Lawrence D'Oliveiro wrote: > On Sun, 18 Feb 2024 23:10:07 +0100, Dmitry A. Kazakov wrote: > >> On 2024-02-18 21:58, Lawrence D'Oliveiro wrote: >>> On Sun, 18 Feb 2024 14:02:32 +0100, Dmitry A. Kazakov wrote: >>> >>>> There is no need in XDR, JSON, ASN.1 or other data representation >>>> mess. They are just worthless overhead. >>> >>> Most languages nowadays have JSON libraries readily available. That is >>> a very easy format to use for passing structured data between >>> processes. >> >> It is easy to jump down the stairwell too. Though I would not recommend >> such course of action... > > Fun fact: you can prove any argument just by coming up with a suitably > spurious analogy. For example, your argument is wrong, just by virtue of > the fact that cats land on their feet. No. There is no argument as you provided none. You did not say why JSON is needed. You said there are libraries. Yes, there are, the Simple Components provides a JSON parser: http://www.dmitry-kazakov.de/ada/components.htm#13.10 So what? The purpose is support of legacy protocols and interfacing other languages. For an Ada program JSON has no use. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
On Sun, 18 Feb 2024 23:10:10 +0100, Dmitry A. Kazakov wrote: > On 2024-02-18 21:56, Lawrence D'Oliveiro wrote: >> On Sun, 18 Feb 2024 11:06:16 +0100, Dmitry A. Kazakov wrote: >> >>> On 2024-02-18 01:00, Lawrence D'Oliveiro wrote: >>> >>>> I thought Windows had pipes. >>> >>> Yes it has, but very rarely used though much better designed than UNIX >>> pipes. >> >> So why don’t programmers use it? > > There is no need in that. It would be so much simpler to use the OS-provided facility, than having to resort to this complicated library which is trying to wrap a stream interface around shared-memory buffers. At least, it would be in POSIX. No doubt the Windows API makes it more complicated ... >>> In general Windows has much richer and better API regarding >>> interprocess communication than Linux. >> >> So why is it that Windows programs tend to avoid running multiple >> processes? > > Because there is no need in multiple processes most of the time. Windows > has a different philosophy and services which preclude the process orgy > so characteristic to UNIX. For example, Windows has and collects many > resources when a process dies. So you do not need a process monitoring > file locks, because there is no any. Windows is the one that keeps files locked, *nix systems typically do not.
On Sun, 18 Feb 2024 23:10:07 +0100, Dmitry A. Kazakov wrote:
> On 2024-02-18 21:58, Lawrence D'Oliveiro wrote:
>> On Sun, 18 Feb 2024 14:02:32 +0100, Dmitry A. Kazakov wrote:
>>
>>> There is no need in XDR, JSON, ASN.1 or other data representation
>>> mess. They are just worthless overhead.
>>
>> Most languages nowadays have JSON libraries readily available. That is
>> a very easy format to use for passing structured data between
>> processes.
>
> It is easy to jump down the stairwell too. Though I would not recommend
> such course of action...
Fun fact: you can prove any argument just by coming up with a suitably
spurious analogy. For example, your argument is wrong, just by virtue of
the fact that cats land on their feet.
On 2024-02-18 21:56, Lawrence D'Oliveiro wrote: > On Sun, 18 Feb 2024 11:06:16 +0100, Dmitry A. Kazakov wrote: > >> On 2024-02-18 01:00, Lawrence D'Oliveiro wrote: >>> On Sat, 17 Feb 2024 14:36:46 +0100, DrPi wrote: >>> >>>> My usage is a bit special. The writing process writes a bunch of data in >>>> a memory buffer then requests this buffer to be transferred to another >>>> process by way of WM_COPYDATA. >>> >>> I thought Windows had pipes. >> >> Yes it has, but very rarely used though much better designed than UNIX >> pipes. > > So why don’t programmers use it? There is no need in that. At least initially UNIX had a distinct philosophy. Its essence was that if a mouse had three buttons, there must have been three processes, one for each button. Any so minuscule task was split into even lesser subtasks connected through pipes. I remember a C compiler that had 5 passes and took forever to compile hello-world. I wonder if anybody still actively uses that messy style of piping awk, grep, sed so typical for early UNIX users. >> In general Windows has much richer and better API regarding interprocess >> communication than Linux. > > So why is it that Windows programs tend to avoid running multiple processes? Because there is no need in multiple processes most of the time. Windows has a different philosophy and services which preclude the process orgy so characteristic to UNIX. For example, Windows has and collects many resources when a process dies. So you do not need a process monitoring file locks, because there is no any. Instead you would deploy a global mutex collected automatically. I do not say that Windows has few processes. It is bloated beyond any reason. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
On 2024-02-18 21:58, Lawrence D'Oliveiro wrote: > On Sun, 18 Feb 2024 14:02:32 +0100, Dmitry A. Kazakov wrote: > >> There is no need in XDR, JSON, ASN.1 >> or other data representation mess. They are just worthless overhead. > > Most languages nowadays have JSON libraries readily available. That is a > very easy format to use for passing structured data between processes. It is easy to jump down the stairwell too. Though I would not recommend such course of action... -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
On Sun, 18 Feb 2024 14:02:32 +0100, Dmitry A. Kazakov wrote:
> There is no need in XDR, JSON, ASN.1
> or other data representation mess. They are just worthless overhead.
Most languages nowadays have JSON libraries readily available. That is a
very easy format to use for passing structured data between processes.
On Sun, 18 Feb 2024 12:36:54 +0100, Björn Lundin wrote:
> On 2024-02-18 01:00, Lawrence D'Oliveiro wrote:
>
>> On Sat, 17 Feb 2024 14:36:46 +0100, DrPi wrote:
>>
>>> My usage is a bit special. The writing process writes a bunch of data in
>>> a memory buffer then requests this buffer to be transferred to another
>>> process by way of WM_COPYDATA.
>>
>> I thought Windows had pipes.
>
> It does,
> We use it for out IPC in both Linux and Windows.
> Works very well.
Why doesn’t the OP use them, then?
On Sun, 18 Feb 2024 11:06:16 +0100, Dmitry A. Kazakov wrote: > On 2024-02-18 01:00, Lawrence D'Oliveiro wrote: >> On Sat, 17 Feb 2024 14:36:46 +0100, DrPi wrote: >> >>> My usage is a bit special. The writing process writes a bunch of data in >>> a memory buffer then requests this buffer to be transferred to another >>> process by way of WM_COPYDATA. >> >> I thought Windows had pipes. > > Yes it has, but very rarely used though much better designed than UNIX > pipes. So why don’t programmers use it? > In general Windows has much richer and better API regarding interprocess > communication than Linux. So why is it that Windows programs tend to avoid running multiple processes?
"Jeffrey R.Carter" <spam.jrcarter.not@spam.acm.org.not> writes: > On 2024-02-18 10:59, Simon Wright wrote: >> Oh, you didn't say that -gnata is needed to provoke the error, >> though >> it's not really a surprise. >> Now, only GCC 11.2.0 doesn't have the error; so it's a regression in >> GCC >> 12. > > Sorry, I should have given my compilation options. You're right that I > used -gnata. But I did say it was related to the Dynamic_Predicate. > > As you have GNAT 14 and I don't, perhaps it would be best for you to > report this. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113979
On 2024-02-18 11:06, Simon Wright wrote: > OK if the participants all have the same endianness. We used XDR (and > the translation cost is nil if the host is big-endian, as PowerPCs are; > all the critical machines were PowerPC). I always override stream attributes and use portable formats. E.g. some chained code for integers. Sign + exponent + normalized mantissa for floats, again chained. That is all. There is no need in XDR, JSON, ASN.1 or other data representation mess. They are just worthless overhead. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
On 2024-02-18 10:59, Simon Wright wrote:
>
> Oh, you didn't say that -gnata is needed to provoke the error, though
> it's not really a surprise.
>
> Now, only GCC 11.2.0 doesn't have the error; so it's a regression in GCC
> 12.
Sorry, I should have given my compilation options. You're right that I used
-gnata. But I did say it was related to the Dynamic_Predicate.
As you have GNAT 14 and I don't, perhaps it would be best for you to report this.
--
Jeff Carter
"We'll make Rock Ridge think it's a chicken
that got caught in a tractor's nuts!"
Blazing Saddles
87
On 2024-02-18 01:00, Lawrence D'Oliveiro wrote:
> On Sat, 17 Feb 2024 14:36:46 +0100, DrPi wrote:
>
>> My usage is a bit special. The writing process writes a bunch of data in
>> a memory buffer then requests this buffer to be transferred to another
>> process by way of WM_COPYDATA.
>
> I thought Windows had pipes.
It does,
We use it for out IPC in both Linux and Windows.
Works very well.
We use named pipes - where each process knows its name through
via env-var
At start they create a named pipe with that name
We use anonymous pipes for client communication
--
/Björn
"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes: > UDP is a kind of thing... Basically, there is no use of UDP except for > broadcasting, e.g. in LAN discovery. Worked for us, sending radar measurements p-2-p at 200 Hz > As for taking apart a UDP packet, it is straightforward. You simply > declare a stream element array of the packet size and map it on the > packet using: > > pragma Import (Ada, A); > for A'Address use UDP_Packet'Address; > > And somewhere > > pragma Assert (Stream_Element'Size = 8); > > just in case... OK if the participants all have the same endianness. We used XDR (and the translation cost is nil if the host is big-endian, as PowerPCs are; all the critical machines were PowerPC).
On 2024-02-18 01:00, Lawrence D'Oliveiro wrote: > On Sat, 17 Feb 2024 14:36:46 +0100, DrPi wrote: > >> My usage is a bit special. The writing process writes a bunch of data in >> a memory buffer then requests this buffer to be transferred to another >> process by way of WM_COPYDATA. > > I thought Windows had pipes. Yes it has, but very rarely used though much better designed than UNIX pipes. See https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-createnamedpipea In general Windows has much richer and better API regarding interprocess communication than Linux. After all Windows NT was sort of descendant of VMS, which was light years ahead of UNIX Sys V. In recent times Linux improved, e.g. they added futex stuff etc. BSD is far worse than Linux in respect of API. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
On 2024-02-17 23:00, Lawrence D'Oliveiro wrote: > On Sat, 17 Feb 2024 10:19:22 +0100, Dmitry A. Kazakov wrote: > >> On 2024-02-16 22:54, Lawrence D'Oliveiro wrote: >> >>> On Fri, 16 Feb 2024 10:41:12 +0100, DrPi wrote: >>> >>>> I though I'll use a Stream writing/reading in/from the memory buffer. >>> >>> Wouldn’t be simplest to let the OS manage the buffering for you? >>> >>> <https://manpages.debian.org/7/pipe.en.html> >> >> That would make applications OS-dependent. > > That’s a standard POSIX function. I think even M****s*ft W**d*ws has > something resembling it. Yes, Windows has a POSIX layer which nobody ever uses. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
Simon Wright <simon@pushface.org> writes:
> "Jeffrey R.Carter" <spam.jrcarter.not@spam.acm.org.not> writes:
>
>> On 2024-02-17 07:04, Randy Brukardt wrote:
>>> I don't see anything wrong with that off-hand. It's probably a
>>> compiler bug of some sort. - Randy.
>>
>> That's what I thought. I know some people have GNAT 14. I'll wait a
>> bit to see if any of them report on if this is still the case before
>> reporting it.
>
> None of GCC 11.2.0, 12.2.0, 13.2.0, 14.0.1 report errors with
> alloc2.adb.
>
> These are all apple-darwin, but the error reported is going to be a
> front-end error.
Oh, you didn't say that -gnata is needed to provoke the error, though
it's not really a surprise.
Now, only GCC 11.2.0 doesn't have the error; so it's a regression in GCC
12.
"Jeffrey R.Carter" <spam.jrcarter.not@spam.acm.org.not> writes:
> On 2024-02-17 07:04, Randy Brukardt wrote:
>> I don't see anything wrong with that off-hand. It's probably a
>> compiler bug of some sort. - Randy.
>
> That's what I thought. I know some people have GNAT 14. I'll wait a
> bit to see if any of them report on if this is still the case before
> reporting it.
None of GCC 11.2.0, 12.2.0, 13.2.0, 14.0.1 report errors with
alloc2.adb.
These are all apple-darwin, but the error reported is going to be a
front-end error.
On Sat, 17 Feb 2024 15:42:13 +0100, DrPi wrote:
> A memory buffer IS limited in size. It is either a peripheral buffer or
> a memory buffer you create yourself (my case). In either case, its size
> is limited. When writing in the stream, you have to care to not overflow
> the buffer.
With pipes, the OS takes care of this for you. Once its kernel buffer is
full, further writes are automatically blocked until a reader has drained
something from the buffer.
It’s called “flow control”.
On Sat, 17 Feb 2024 14:36:46 +0100, DrPi wrote:
> My usage is a bit special. The writing process writes a bunch of data in
> a memory buffer then requests this buffer to be transferred to another
> process by way of WM_COPYDATA.
I thought Windows had pipes.
On Sat, 17 Feb 2024 10:19:22 +0100, Dmitry A. Kazakov wrote:
> On 2024-02-16 22:54, Lawrence D'Oliveiro wrote:
>
>> On Fri, 16 Feb 2024 10:41:12 +0100, DrPi wrote:
>>
>>> I though I'll use a Stream writing/reading in/from the memory buffer.
>>
>> Wouldn’t be simplest to let the OS manage the buffering for you?
>>
>> <https://manpages.debian.org/7/pipe.en.html>
>
> That would make applications OS-dependent.
That’s a standard POSIX function. I think even M****s*ft W**d*ws has
something resembling it.
On 2024-02-17 19:09, Simon Wright wrote: > I can't remember at this distance in time, but I think I would have > liked to construct a memory stream on the received UDP packet rather > than copying the content; the compiler wouldn't let me. Perhaps worth > another try. UDP is a kind of thing... Basically, there is no use of UDP except for broadcasting, e.g. in LAN discovery. In all other cases it is either TCP or multicast. Since UDP does not guarantee either delivery or ordering. It would be a huge overhead to implement reliable buffered streams on top of UDP, with sequence numbers, acknowledgements, re-sending, reordering etc. As for taking apart a UDP packet, it is straightforward. You simply declare a stream element array of the packet size and map it on the packet using: pragma Import (Ada, A); for A'Address use UDP_Packet'Address; And somewhere pragma Assert (Stream_Element'Size = 8); just in case... -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
Le 17/02/2024 à 15:42, DrPi a écrit : > Le 17/02/2024 à 15:26, J-P. Rosen a écrit : >> Le 17/02/2024 à 14:36, DrPi a écrit : >> > The library Jean-Pierre pointed me to perfectly matches this usage. Light and easy to use. Thanks. >> 🙂 >> >> > One enhancement I see is to manage the buffer size to avoid buffer overflow (or did I missed something ?). >> >> I don't see what you mean here... On the memory side, we are reading/writing bytes from memory, there is no notion of overflow. And the number of bytes processed by Read/Write is given by the size of Item, so no overflow either... >> > A memory buffer IS limited in size. It is either a peripheral buffer or a memory buffer you create yourself (my case). In either case, its size is limited. When writing in the stream, you have to care to not overflow the buffer. The purpose of this stream is to access raw memory, so there is no notion of "buffer size". It is up to you to match your (user) buffer with the memory buffer. Of course, you can add a layer with all the checks you want... [PS] I tried to respond to your email, but it bounced... -- J-P. Rosen Adalog 2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX https://www.adalog.fr https://www.adacontrol.fr
"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes:
> Note, that if you implement stream Read/Write as individual Windows
> messages it will become extremely slow. GNAT optimizes streaming of
> some built-in objects, e.g. String. But as a general case you should
> expect that streaming of any non-scalar object would cause multiple
> calls to Read/Write and thus multiple individual Windows messages.
Our motivation for the memory stream was the equivalent of this for
UDP messages; GNAT.Sockets behaves (behaved?) exactly like this, so we
buffered the result of 'Output & wrote the constructed buffer to the
socket; on the other side, we read the UDP message, stuffed its contents
into a memory stream, then let the client 'Input.
I can't remember at this distance in time, but I think I would have
liked to construct a memory stream on the received UDP packet rather
than copying the content; the compiler wouldn't let me. Perhaps worth
another try.
Le 17/02/2024 à 15:28, Dmitry A. Kazakov a écrit :
> On 2024-02-17 14:36, DrPi wrote:
>
>> Concerning the OS and the buffer transfert mechanism, as I said, this
>> is under control. I use Windows and the WM_COPYDATA message.
>>
>> My usage is a bit special. The writing process writes a bunch of data
>> in a memory buffer then requests this buffer to be transferred to
>> another process by way of WM_COPYDATA. The receiving process reads the
>> data from the "new" memory buffer. I say "new" since the address is
>> different from the one used in the writing process (of course it can
>> not be the same).
>
> You ask Windows to copy a chunk of memory from one process space into
> another, so yes it is physically different memory. Different or same
> address tells nothing because under Windows System.Address is virtual
> and can point anywhere.
>
> As you may guess it is a quite heavy overhead, not only because of
> copying data between process spaces, but also because of sending and
> dispatching Windows messages.
>
> Note, that if you implement stream Read/Write as individual Windows
> messages it will become extremely slow. GNAT optimizes streaming of some
> built-in objects, e.g. String. But as a general case you should expect
> that streaming of any non-scalar object would cause multiple calls to
> Read/Write and thus multiple individual Windows messages.
>
> An efficient way to exchange data under Windows is a file mapping. See
> CreateFileMapping and MapViewOfFile.
>
>
> https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-createfilemappinga
>
>
> https://learn.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-mapviewoffile
>
> Then use CreateEvent with a name to signal states of the stream buffer
> system-wide. Named Windows events are shared between processes.
>
>
> https://learn.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-createeventa
>
> [ This is how interprocess stream is implemented for Windows in Simple
> Components ]
>
In my use case, there is no performance problem.
The purpose is to make an editor simple instance. When you launch the
editor the first time, everything is done as usual. Next time you launch
the editor (for example by double clicking on a file in file explorer)
the init code of the editor detects an instance of the editor is already
running, transfers the command line arguments to the first instance and
exit.
The buffer transfert occurs once when starting a new instance of the editor.
However, I keep your solution in mind. I might need it one day.
Thanks.
On 2024-02-17 15:26, J-P. Rosen wrote: > On the memory side, we are > reading/writing bytes from memory, there is no notion of overflow. In the Simple Components there is a pipe stream. type Pipe_Stream ( Size : Stream_Element_Count ) is new Root_Stream_Type with private; When a task writes the stream full (Size elements), it gets blocked until another task reads something out. Another implementation type Storage_Stream ( Block_Size : Stream_Element_Count ) is new Root_Stream_Type with private; rather allocates a new block of memory. The allocated blocks get reused when their contents is read out. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
Le 17/02/2024 à 15:26, J-P. Rosen a écrit :
> Le 17/02/2024 à 14:36, DrPi a écrit :
> > The library Jean-Pierre pointed me to perfectly matches this usage.
> Light and easy to use. Thanks.
> :-)
>
> > One enhancement I see is to manage the buffer size to avoid buffer
> overflow (or did I missed something ?).
>
> I don't see what you mean here... On the memory side, we are
> reading/writing bytes from memory, there is no notion of overflow. And
> the number of bytes processed by Read/Write is given by the size of
> Item, so no overflow either...
>
A memory buffer IS limited in size. It is either a peripheral buffer or
a memory buffer you create yourself (my case). In either case, its size
is limited. When writing in the stream, you have to care to not overflow
the buffer.
On 2024-02-17 14:36, DrPi wrote: > Concerning the OS and the buffer transfert mechanism, as I said, this is > under control. I use Windows and the WM_COPYDATA message. > > My usage is a bit special. The writing process writes a bunch of data in > a memory buffer then requests this buffer to be transferred to another > process by way of WM_COPYDATA. The receiving process reads the data from > the "new" memory buffer. I say "new" since the address is different from > the one used in the writing process (of course it can not be the same). You ask Windows to copy a chunk of memory from one process space into another, so yes it is physically different memory. Different or same address tells nothing because under Windows System.Address is virtual and can point anywhere. As you may guess it is a quite heavy overhead, not only because of copying data between process spaces, but also because of sending and dispatching Windows messages. Note, that if you implement stream Read/Write as individual Windows messages it will become extremely slow. GNAT optimizes streaming of some built-in objects, e.g. String. But as a general case you should expect that streaming of any non-scalar object would cause multiple calls to Read/Write and thus multiple individual Windows messages. An efficient way to exchange data under Windows is a file mapping. See CreateFileMapping and MapViewOfFile. https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-createfilemappinga https://learn.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-mapviewoffile Then use CreateEvent with a name to signal states of the stream buffer system-wide. Named Windows events are shared between processes. https://learn.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-createeventa [ This is how interprocess stream is implemented for Windows in Simple Components ] -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
Le 17/02/2024 à 14:36, DrPi a écrit : > The library Jean-Pierre pointed me to perfectly matches this usage. Light and easy to use. Thanks. :-) > One enhancement I see is to manage the buffer size to avoid buffer overflow (or did I missed something ?). I don't see what you mean here... On the memory side, we are reading/writing bytes from memory, there is no notion of overflow. And the number of bytes processed by Read/Write is given by the size of Item, so no overflow either... -- J-P. Rosen Adalog 2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX https://www.adalog.fr https://www.adacontrol.fr
Le 16/02/2024 à 10:41, DrPi a écrit :
> I want to transfert some data between applications through a memory buffer.
> The buffer transfert between applications is under control.
> My problem is with the buffer content.
> I though I'll use a Stream writing/reading in/from the memory buffer.
> How can I achieve this ? I've found no example doing this.
> Note : I use Ada 2012.
Thanks all for your answers.
Concerning the OS and the buffer transfert mechanism, as I said, this is
under control. I use Windows and the WM_COPYDATA message.
My usage is a bit special. The writing process writes a bunch of data in
a memory buffer then requests this buffer to be transferred to another
process by way of WM_COPYDATA. The receiving process reads the data from
the "new" memory buffer. I say "new" since the address is different from
the one used in the writing process (of course it can not be the same).
The library Jean-Pierre pointed me to perfectly matches this usage.
Light and easy to use. Thanks.
One enhancement I see is to manage the buffer size to avoid buffer
overflow (or did I missed something ?).
Thanks again to everybody.
Nicolas
On 2024-02-16 22:54, Lawrence D'Oliveiro wrote: > On Fri, 16 Feb 2024 10:41:12 +0100, DrPi wrote: > >> I though I'll use a Stream writing/reading in/from the memory buffer. > > Wouldn’t be simplest to let the OS manage the buffering for you? > > <https://manpages.debian.org/7/pipe.en.html> That would make applications OS-dependent. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
Le 14/02/2024 à 05:28, Randy Brukardt a écrit :
> Ah, yes, didn't notice that part. One cannot give the Aggregate aspect on an
> array type, directly or indirectly. That's because container aggregates are
> designed to work like array aggregates, and we didn't want visibility to
> determine the interpretation of an aggregate (especially where the same
> syntax could have a different meaning in different visibility).. Thus, there
> can be no point where a single type can have both array aggregates and
> container aggregates.
>
> Note that record aggregates and container aggregates are always syntactally
> different, and thus it is OK to have both in a single location (that's one
> of the reasons that we adopted square brackets for container aggregates).
> That seemed important as the majority of private types are completed by
> record types, and not allowing record types in this context would be
> difficult to work around.
Thanks Randy for the explanation, it helps.
Pascal.
In case there's any NeoVim users who also publish Alire packages, I wrote a plugin for that; https://github.com/TamaMcGlinn/nvim-alire-tools allows you to bind or call `:AlirePublish` which handles everything for your alire toml file, and intelligently sees where you are in the version publishing process.
On 2024-02-17 07:04, Randy Brukardt wrote:
> I don't see anything wrong with that off-hand. It's probably a compiler bug
> of some sort. - Randy.
That's what I thought. I know some people have GNAT 14. I'll wait a bit to see
if any of them report on if this is still the case before reporting it.
--
Jeff Carter
"Drown in a vat of whiskey. Death, where is thy sting?"
Never Give a Sucker an Even Break
106
I don't see anything wrong with that off-hand. It's probably a compiler bug
of some sort. - Randy.
"Jeffrey R.Carter" <spam.jrcarter.not@spam.acm.org.not> wrote in message
news:uqos24$3rue0$2@dont-email.me...
> On 2024-02-17 00:26, Niklas Holsti wrote:
>>
>> You showed two copies of the declaration (spec) of package Alloc_Err, but
>> you did not show the body of the package. Based on the error message
>> pointing to alloc_err.adb (and not .ads), GNAT thinks the error is in the
>> body. Please show the body of the package.
>>
>
> Oops. Well, I've managed to simplify the reproducer to
>
> procedure Alloc2 is
> type Grid is array (Positive range <>, Positive range <>) of Integer
> with
> Dynamic_Predicate => Grid'First (1) = 1 and Grid'First (2) = 1;
>
> type Grid_Ptr is access Grid;
>
> Data : Grid_Ptr := new Grid (1 .. 10, 1 .. 20);
> begin -- Alloc2
> null;
> end Alloc2;
>
> which results in
>
> alloc2.adb:7:23: error: invalid use of subtype mark in expression or call
>
> Line 7 is the declaration of Data.
>
> --
> Jeff Carter
> "I like it when the support group complains that they have
> insufficient data on mean time to repair bugs in Ada software."
> Robert I. Eachus
> 91
>
On 2024-02-17 00:26, Niklas Holsti wrote:
>
> You showed two copies of the declaration (spec) of package Alloc_Err, but you
> did not show the body of the package. Based on the error message pointing to
> alloc_err.adb (and not .ads), GNAT thinks the error is in the body. Please show
> the body of the package.
>
Oops. Well, I've managed to simplify the reproducer to
procedure Alloc2 is
type Grid is array (Positive range <>, Positive range <>) of Integer with
Dynamic_Predicate => Grid'First (1) = 1 and Grid'First (2) = 1;
type Grid_Ptr is access Grid;
Data : Grid_Ptr := new Grid (1 .. 10, 1 .. 20);
begin -- Alloc2
null;
end Alloc2;
which results in
alloc2.adb:7:23: error: invalid use of subtype mark in expression or call
Line 7 is the declaration of Data.
--
Jeff Carter
"I like it when the support group complains that they have
insufficient data on mean time to repair bugs in Ada software."
Robert I. Eachus
91
On 2024-02-17 0:51, Jeffrey R.Carter wrote:
> I have this code:
>
> package Alloc_Err is
> type RT is record
> F1 : Integer;
> F2 : Integer;
> end record;
>
> type Grid is array (Positive range <>, Positive range <>) of RT with
> Dynamic_Predicate => Grid'First (1) = 1 and Grid'First (2) = 1;
>
> procedure What;
> end Alloc_Err;
>
> package Alloc_Err is
> type RT is record
> F1 : Integer;
> F2 : Integer;
> end record;
>
> type Grid is array (Positive range <>, Positive range <>) of RT with
> Dynamic_Predicate => Grid'First (1) = 1 and Grid'First (2) = 1;
>
> procedure What;
> end Alloc_Err;
>
> and GNAT 12.3.0 and 13.2.0 say
>
> alloc_err.adb:5:26: error: invalid use of subtype mark in expression or
> call
>
> This doesn't happen if the Dynamic_Predicate is removed. This looks like
> an error to me, but I thought I'd better see if there's something I've
> missed.
You showed two copies of the declaration (spec) of package Alloc_Err,
but you did not show the body of the package. Based on the error message
pointing to alloc_err.adb (and not .ads), GNAT thinks the error is in
the body. Please show the body of the package.
I have this code: package Alloc_Err is type RT is record F1 : Integer; F2 : Integer; end record; type Grid is array (Positive range <>, Positive range <>) of RT with Dynamic_Predicate => Grid'First (1) = 1 and Grid'First (2) = 1; procedure What; end Alloc_Err; package Alloc_Err is type RT is record F1 : Integer; F2 : Integer; end record; type Grid is array (Positive range <>, Positive range <>) of RT with Dynamic_Predicate => Grid'First (1) = 1 and Grid'First (2) = 1; procedure What; end Alloc_Err; and GNAT 12.3.0 and 13.2.0 say alloc_err.adb:5:26: error: invalid use of subtype mark in expression or call This doesn't happen if the Dynamic_Predicate is removed. This looks like an error to me, but I thought I'd better see if there's something I've missed. -- Jeff Carter "I like it when the support group complains that they have insufficient data on mean time to repair bugs in Ada software." Robert I. Eachus 91
On Fri, 16 Feb 2024 10:41:12 +0100, DrPi wrote: > I though I'll use a Stream writing/reading in/from the memory buffer. Wouldn’t be simplest to let the OS manage the buffering for you? <https://manpages.debian.org/7/pipe.en.html>
DrPi <314@drpi.fr> writes: > Hi, > > I want to transfert some data between applications through a memory buffer. > The buffer transfert between applications is under control. > My problem is with the buffer content. > I though I'll use a Stream writing/reading in/from the memory > buffer. How can I achieve this ? I've found no example doing this. > Note : I use Ada 2012. > > Nicolas A spec and body for an implementation I've had since 2008: https://github.com/simonjwright/coldframe/blob/alire/src/common/coldframe-memory_streams.ads https://github.com/simonjwright/coldframe/blob/alire/src/common/coldframe-memory_streams.adb
----------------------------------------------------------------------- UPDATED Call for Contributions - Additional Tracks 28th Ada-Europe International Conference on Reliable Software Technologies (AEiC 2024) 11-14 June 2024, Barcelona, Spain *** DEADLINES approaching: 26 February and 4 March 2024 *** www.ada-europe.org/conference2024 --------------------------------- *** Submission DEADLINE 26 February 2024 *** Workshops: submit to Workshop Chair, Sergio Saez <ssaez@disca.upv.es> subject "[AEiC 2024: workshop proposal]" Tutorials: submit to Tutorial and Education Chair, Maria A. Serrano <maria.serrano@nearbycomputing.com> subject "[AEiC 2024: tutorial proposal]" *** EXTENDED submission DEADLINE 4 March 2024 *** Industrial- and Work-in-Progress-track: submit via https://easychair.org/my/conference?conf=aeic2024 select "Industrial Track" or "Work in Progress Track" For more information please see the full Call for Papers at www.ada-europe.org/conference2024/cfp.html --------------------------------- Organized by Ada-Europe and Barcelona Supercomputing Center (BSC), in cooperation with Barcelona ACM-W Chapter, ACM SIGAda, ACM SIGBED, ACM SIGPLAN, Ada Resource Association (ARA), and OpenMP #AEiC2024 #AdaEurope #AdaProgramming ----------------------------------------------------------------------- Our apologies if you receive multiple copies of this announcement. Please circulate widely. Dirk Craeynest, AEiC 2024 Publicity Chair Dirk.Craeynest@cs.kuleuven.be * 28th Ada-Europe Int. Conf. Reliable Software Technologies (AEiC 2024) * June 11-14, 2024, Barcelona, Spain, www.ada-europe.org/conference2024 (V6.1)
Hi, AWS comes with a memory stream implementation. https://github.com/AdaCore/aws/blob/master/include/memory_streams.ads You may want to have a look here. Have a nice day, -- Pascal Obry / Magny Les Hameaux (78) The best way to travel is by means of imagination http://photos.obry.net gpg --keyserver keys.gnupg.net --recv-key F949BD3B
On 2024-02-16 10:41, DrPi wrote: > I want to transfert some data between applications through a memory buffer. > The buffer transfert between applications is under control. > My problem is with the buffer content. > I though I'll use a Stream writing/reading in/from the memory buffer. > How can I achieve this ? I've found no example doing this. It of course depends on the target operating system. You need to create a shared region or memory mapped file etc. You also need system-wide events to signal the stream ends empty or full. Simple Components has an implementation interprocess streams for usual suspects: http://www.dmitry-kazakov.de/ada/components.htm#12.7 > Note : I use Ada 2012. No problem, it is kept Ada 95 compatible. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
Le 16/02/2024 à 10:41, DrPi a écrit : > Hi, > > I want to transfert some data between applications through a memory buffer. > The buffer transfert between applications is under control. > My problem is with the buffer content. > I though I'll use a Stream writing/reading in/from the memory buffer. > How can I achieve this ? I've found no example doing this. > Note : I use Ada 2012. > I don't know if this is what you want, but at least it is an example of using streams... Package Storage_Streams, from Adalog's components page: https://adalog.fr/en/components.html#Storage_Stream -- J-P. Rosen Adalog 2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX https://www.adalog.fr https://www.adacontrol.fr
Hi, I want to transfert some data between applications through a memory buffer. The buffer transfert between applications is under control. My problem is with the buffer content. I though I'll use a Stream writing/reading in/from the memory buffer. How can I achieve this ? I've found no example doing this. Note : I use Ada 2012. Nicolas
Hello! It is not still 2023! With kind regards.
Ah, yes, didn't notice that part. One cannot give the Aggregate aspect on an
array type, directly or indirectly. That's because container aggregates are
designed to work like array aggregates, and we didn't want visibility to
determine the interpretation of an aggregate (especially where the same
syntax could have a different meaning in different visibility).. Thus, there
can be no point where a single type can have both array aggregates and
container aggregates.
Note that record aggregates and container aggregates are always syntactally
different, and thus it is OK to have both in a single location (that's one
of the reasons that we adopted square brackets for container aggregates).
That seemed important as the majority of private types are completed by
record types, and not allowing record types in this context would be
difficult to work around.
Randy.
"Simon Wright" <simon@pushface.org> wrote in message
news:lybk8klh9u.fsf@pushface.org...
> "Randy Brukardt" <randy@rrsoftware.com> writes:
>
>> Looks like a compiler bug to me. The nonsense message gives that away...
>> :-)
>
> GCC 14.0.1 says
>
> 1. procedure test_20240211_static_choice is
> 2.
> 3. package Maps is
> 4. type Map_Type is private
> 5. with Aggregate => (Empty => Empty_Map,
> |
> >>> error: aspect "Aggregate" can only be applied to non-array type
>
> 6. Add_Named => Add_To_Map);
> 7. procedure Add_To_Map (M : in out Map_Type; Key : in Integer;
> 8. Value : in String);
> 9. Empty_Map : constant Map_Type;
> 10. private
> 11. type Map_Type is array (1..10) of String (1..10);
> 12. procedure Add_To_Map (M : in out Map_Type; Key : in Integer;
> 13. Value : in String) is null;
> 14. Empty_Map : constant Map_Type := [1..10 => " "];
> |
> >>> error: choice must be static
>
> 15. end;
> 16.
> 17. begin
> 18. null;
> 19. end;
>
> I think the first is because of ARM 4.3.5(2), "For a type other than an
> array type, the following type-related operational aspect may be
> specified"[1] and the second is a "nonsense" consequence.
>
> [1] http://www.ada-auth.org/standards/22rm/html/RM-4-3-5.html#p2
"Randy Brukardt" <randy@rrsoftware.com> writes: > Looks like a compiler bug to me. The nonsense message gives that away... :-) GCC 14.0.1 says 1. procedure test_20240211_static_choice is 2. 3. package Maps is 4. type Map_Type is private 5. with Aggregate => (Empty => Empty_Map, | >>> error: aspect "Aggregate" can only be applied to non-array type 6. Add_Named => Add_To_Map); 7. procedure Add_To_Map (M : in out Map_Type; Key : in Integer; 8. Value : in String); 9. Empty_Map : constant Map_Type; 10. private 11. type Map_Type is array (1..10) of String (1..10); 12. procedure Add_To_Map (M : in out Map_Type; Key : in Integer; 13. Value : in String) is null; 14. Empty_Map : constant Map_Type := [1..10 => " "]; | >>> error: choice must be static 15. end; 16. 17. begin 18. null; 19. end; I think the first is because of ARM 4.3.5(2), "For a type other than an array type, the following type-related operational aspect may be specified"[1] and the second is a "nonsense" consequence. [1] http://www.ada-auth.org/standards/22rm/html/RM-4-3-5.html#p2
Looks like a compiler bug to me. The nonsense message gives that away... :-)
Randy.
"Blady" <p.p11@orange.fr> wrote in message
news:uqaek7$vd8o$1@dont-email.me...
> Hello,
>
> I've got the following GNAT error:
>
> $ gcc -c -gnat2022 -gnatl 2024/test_20240211_static_choice.adb
> GNAT 13.2.0
> 1. procedure test_20240211_static_choice is
> 2.
> 3. package Maps is
> 4. type Map_Type is private
> 5. with Aggregate => (Empty => Empty_Map,
> 6. Add_Named => Add_To_Map);
> 7. procedure Add_To_Map (M : in out Map_Type; Key : in Integer;
> Value : in String);
> 8. Empty_Map : constant Map_Type;
> 9. private
> 10. type Map_Type is array (1..10) of String (1..10);
> 11. procedure Add_To_Map (M : in out Map_Type; Key : in Integer;
> Value : in String) is null;
> 12. Empty_Map : constant Map_Type := [1..10 => " "]; --
> error: choice must be static
> |
> >>> error: choice must be static
>
> 13. end;
> 14.
> 15. begin
> 16. null;
> 17. end;
>
> I wonder what more static it should be.
> Any clue ?
>
> Thanks, Pascal.
>
> Source code:
> procedure test_20240211_static_choice is
>
> package Maps is
> type Map_Type is private
> with Aggregate => (Empty => Empty_Map,
> Add_Named => Add_To_Map);
> procedure Add_To_Map (M : in out Map_Type; Key : in Integer; Value :
> in String);
> Empty_Map : constant Map_Type;
> private
> type Map_Type is array (1..10) of String (1..10);
> procedure Add_To_Map (M : in out Map_Type; Key : in Integer; Value :
> in String) is null;
> Empty_Map : constant Map_Type := [1..10 => " "]; --
> error: choice must be static
> end;
>
> begin
> null;
> end;
Hello everybody! I would like to announce the March (2024) Ada Monthly Meetup which will be taking place on the 9th of March at 14:00 UTC time (15:00 CET). As always the meetup will take place over at Jitsi. The Meetup will also be livestreamed to Youtube. If someone would like to propose a talk or a topic, feel free to do so! We currently have no topics :wink: Here are the connection details from previous posts: The meetup will take place over at Jitsi, a conferencing software that runs on any modern browser. The link is [1]. The room name is “AdaMonthlyMeetup” and in case it asks for a password, it will be set to “AdaRules”. I do not want to set up a password, but in case it is needed, it will be the one above without the quotes. The room name is generally not needed as the link should take you directly there, but I want to write it down just in case someone needs it. Best regards and see you soon! Fer [1] https://meet.jit.si/AdaMonthlyMeetup
On 2024-02-11 21:56, Jeffrey R.Carter wrote: > I don't know what this means, but it's definitely related to the > Aggregate aspect. Square brackets is the root of all evil! (:-)) -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
On 2024-02-11 13:29, Blady wrote:
> Hello,
>
> I've got the following GNAT error:
>
> $ gcc -c -gnat2022 -gnatl 2024/test_20240211_static_choice.adb
> GNAT 13.2.0
> 1. procedure test_20240211_static_choice is
> 2.
> 3. package Maps is
> 4. type Map_Type is private
> 5. with Aggregate => (Empty => Empty_Map,
> 6. Add_Named => Add_To_Map);
> 7. procedure Add_To_Map (M : in out Map_Type; Key : in Integer;
> Value : in String);
> 8. Empty_Map : constant Map_Type;
> 9. private
> 10. type Map_Type is array (1..10) of String (1..10);
> 11. procedure Add_To_Map (M : in out Map_Type; Key : in Integer;
> Value : in String) is null;
> 12. Empty_Map : constant Map_Type := [1..10 => " "]; --
> error: choice must be static
> |
> >>> error: choice must be static
>
> 13. end;
> 14.
> 15. begin
> 16. null;
> 17. end;
>
> I wonder what more static it should be.
I don't know what this means, but it's definitely related to the Aggregate
aspect. This compiles:
procedure Test_20240211_Static_Choice is
package Maps is
type Map_Type is private
with Aggregate => (Empty => Empty_Map,
Add_Named => Add_To_Map);
procedure Add_To_Map (M : in out Map_Type; Key : in Integer; Value : in
String);
Empty_Map : constant Map_Type;
private
type Map_Base is array (1 .. 10) of String (1 .. 10);
type Map_Type is new Map_Base;
procedure Add_To_Map (M : in out Map_Type; Key : in Integer; Value : in
String) is null;
Empty_Base : constant Map_Base := (1 .. 10 => (1 .. 10 => ' ') );
Empty_Map : constant Map_Type := Map_Type (Empty_Base);
end Maps;
begin
null;
end Test_20240211_Static_Choice;
--
Jeff Carter
"Nobody expects the Spanish Inquisition!"
Monty Python's Flying Circus
22
Hello, I've got the following GNAT error: $ gcc -c -gnat2022 -gnatl 2024/test_20240211_static_choice.adb GNAT 13.2.0 1. procedure test_20240211_static_choice is 2. 3. package Maps is 4. type Map_Type is private 5. with Aggregate => (Empty => Empty_Map, 6. Add_Named => Add_To_Map); 7. procedure Add_To_Map (M : in out Map_Type; Key : in Integer; Value : in String); 8. Empty_Map : constant Map_Type; 9. private 10. type Map_Type is array (1..10) of String (1..10); 11. procedure Add_To_Map (M : in out Map_Type; Key : in Integer; Value : in String) is null; 12. Empty_Map : constant Map_Type := [1..10 => " "]; -- error: choice must be static | >>> error: choice must be static 13. end; 14. 15. begin 16. null; 17. end; I wonder what more static it should be. Any clue ? Thanks, Pascal. Source code: procedure test_20240211_static_choice is package Maps is type Map_Type is private with Aggregate => (Empty => Empty_Map, Add_Named => Add_To_Map); procedure Add_To_Map (M : in out Map_Type; Key : in Integer; Value : in String); Empty_Map : constant Map_Type; private type Map_Type is array (1..10) of String (1..10); procedure Add_To_Map (M : in out Map_Type; Key : in Integer; Value : in String) is null; Empty_Map : constant Map_Type := [1..10 => " "]; -- error: choice must be static end; begin null; end;
[-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain, Size: 15809 bytes --] ----------------------------------------------------------------------- Call for Contributions - Additional Tracks 28th Ada-Europe International Conference on Reliable Software Technologies (AEiC 2024) 11-14 June 2024, Barcelona, Spain www.ada-europe.org/conference2024 *** 2nd submission DEADLINE 26 February 2024 *** *** Industrial & Work-in-Progress track, Tutorials, Workshops *** Organized by Ada-Europe and Barcelona Supercomputing Center (BSC), in cooperation with ACM SIGAda, ACM SIGBED, ACM SIGPLAN, and Ada Resource Association (ARA) #AEiC2024 #AdaEurope #AdaProgramming ----------------------------------------------------------------------- *** General Information The 28th Ada-Europe International Conference on Reliable Software Technologies (AEiC 2024) will take place in Barcelona, Spain. AEiC is a leading international forum for providers, practitioners, and researchers in reliable software technologies. The conference presentations will illustrate current work in the theory and practice of the design, development, and maintenance of long-lived, high-quality software systems for a challenging variety of application domains. The program will also include keynotes, Q&A and discussion sessions, and social events. Participants include practitioners and researchers from industry, academia, and government organizations active in the development of reliable software technologies. The topics of interest for the conference include but are not limited to (more specific topics are described on the conference web page): * Formal and Model-Based Engineering of Critical Systems; * High-Integrity Systems and Reliability; * AI for High-Integrity Systems Engineering; * Real-Time Systems; * Ada Language; * Applications in Relevant Domains. The conference comprises different tracks and co-located events: * Journal track papers present research advances supported by solid theoretical foundation and thorough evaluation. * Industrial track contributions highlight industrial open challenges and/or the practitioners' side of a relevant case study or industrial project. * Work-in-progress track papers illustrate novel research ideas that are still at an initial stage, between conception and first prototype. * Tutorials guide attenders through a hands-on familiarization with innovative developments or with useful features related to reliable software. * Workshops provide discussion forums on themes related to the conference topics. * Vendor presentations and exhibitions allow for companies to showcase their latest products and services. *** Important Dates [CLOSED] Extended submission deadline for journal track papers 26 February 2024 Deadline for submission of industrial track papers, work-in-progress papers, tutorial and workshop proposals 22 March 2024 First round notification for journal track papers, and notification of acceptance for all other types of submissions 11-14 June 2024 Conference *** Call for Journal Track Submissions Following a journal-first model, this edition of the conference includes a journal track, which seeks original and high-quality papers that describe mature research work on the conference topics. Accepted journal track papers will be published in a Special Issue of Elsevier JSA - the Journal of Systems Architecture (Q1 ranked, CiteScore 8.5, impact factor 4.5). Accordingly, the conference is listed as "Journal Published" in the latest update of the CORE Conference Ranking released in August 2023. [Submission details removed. Call is closed now.] Authors who have successfully passed the first round of review will be invited to present their work at the conference. The abstract of the accepted contributions will be included in the conference booklet. The Ada-Europe organization will waive the Open Access fees for the first four accepted papers (whose authors do not already enjoy Open Access agreements). Subsequent papers will follow JSA regular publishing track. *** Call for Industrial Track Submissions The conference seeks industrial practitioner presentations that deliver insight on the challenges of developing reliable software. Especially welcome kinds of submissions are listed on the conference website. Given their applied nature, such contributions will be subject to a dedicated practitioner-peer review process. Interested authors shall submit a 1-to-2 pages abstract, by 26 February 2024, via EasyChair at https://easychair.org/my/conference?conf=aeic2024, selecting the "Industrial Track". The format for submission is strictly in PDF, following the Ada User Journal style. Templates are available at http://www.ada-europe.org/auj/guide. The abstract of the accepted contributions will be included in the conference booklet. The corresponding authors will get a presentation slot in the prime-time technical program of the conference and will also be invited to expand their contributions into full-fledged articles for publication in the Ada User Journal, which will form the proceedings of the industrial track of the Conference. Prospective authors may direct all enquiries regarding this track to its chairs Luciana Provenzano (luciana.provenzano@mdu.se) and Michael Pressler (Michael.Pressler@de.bosch.com). *** Call for Work-in-Progress Track Submissions The work-in-progress track seeks two kinds of submissions: (a) ongoing research and (b) early-stage ideas. Ongoing research submissions are 4-page papers describing research results that are not mature enough to be submitted to the journal track. Early-stage ideas are 1-page papers that pitch new research directions that fall within the scope of the conference. Both kinds of submissions must be original and shall undergo anonymous peer review. Submissions by recent MSc graduates and PhD students are especially sought. Authors shall submit their work by 26 February 2024, via EasyChair at https://easychair.org/my/conference?conf=aeic2024, selecting the "Work-in-Progress Track". The format for submission is strictly in PDF, following the Ada User Journal style. Templates are available at http://www.ada-europe.org/auj/guide. The abstract of the accepted contributions will be included in the conference booklet. The corresponding authors will get a presentation slot in the prime-time technical program of the conference and will also be offered the opportunity to expand their contributions into 4-page articles for publication in the Ada User Journal, which will form the proceedings of the WiP track of the Conference. Prospective authors may direct all enquiries regarding this track to the corresponding chairs Alejandro R. Mosteo (amosteo@unizar.es) and Ruben Martins (rubenm@andrew.cmu.edu). *** Awards The organization will offer an honorary award for the best technical presentation, to be announced in the closing session of the conference. *** Call for Tutorials The conference seeks tutorials in the form of educational seminars on themes falling within the conference scope, with an academic or practitioner slant, including hands-on or practical elements. Tutorial proposals shall include a title, an abstract, a description of the topic, an outline of the presentation, the proposed duration (half-day or full-day), the intended level of the contents (introductory, intermediate, or advanced), and a statement motivating attendance. Tutorial proposals shall be submitted at any time but no later than the 26 February 2024 to the respective chair Maria A. Serrano (maria.serrano@nearbycomputing.com), with subject line: "[AEiC 2024: tutorial proposal]". Once submitted, each tutorial proposal will be evaluated by the conference organizers as soon as possible, with decisions from January 1st. The authors of accepted full-day tutorials will receive a complimentary conference registration, halved for half-day tutorials. The Ada User Journal will offer space for the publication of summaries of the accepted tutorials. *** Call for Workshops The conference welcomes satellite workshops centred on themes that fall within the conference scope. Proposals may be submitted for half- or full-day events, to be scheduled at either end of the AEiC conference. Workshop organizers shall also commit to producing the proceedings of the event, for publication in the Ada User Journal. Workshop proposals shall be submitted at any time but no later than the 26 February 2024 to the respective chair Sergio Saez (ssaez@disca.upv.es), with subject line: "[AEiC 2024: workshop proposal]". Once submitted, each workshop proposal will be evaluated by the conference organizers as soon as possible, with decisions from January 1st. *** Academic Listing The Journal of Systems Architecture, publication venue of the journal track proceedings of the conference, is Q1 ranked, with CiteScore 8.5 and Impact Factor 4.5. The Ada User Journal, venue of all other technical proceedings of the conference, is indexed by Scopus and by EBSCOhost in the Academic Search Ultimate database. *** Call for Exhibitors and Sponsors The conference will include a vendor and technology exhibition with the option of a 20 minutes presentation as part of the conference program. Interested providers should direct inquiries to the Exhibition & Sponsorship Chair Ahlan Marriot (ahlan@ada-switzerland.ch). *** Venue The conference will take place in Barcelona, Spain. Barcelona is a major cultural, economic, and financial centre, known for its architecture, culture, and Mediterranean atmosphere, a hub for technology and innovation. There's plenty to see and visit in Barcelona, so plan in advance! *** Organizing Committee - Conference Chair Sara Royuela, Barcelona Supercomputing Center, Spain sara.royuela@bsc.es - Journal Track Chairs Bjorn Andersson, Carnegie Mellon University, USA baandersson@sei.cmu.edu Luis Miguel Pinho, ISEP & INESC TEC, Portugal lmp@isep.ipp.pt - Industrial Track Chairs Luciana Provenzano, Mälardalen University, Sweden luciana.provenzano@mdu.se Michael Pressler, Robert Bosch GmbH, Germany Michael.Pressler@de.bosch.com - Work-In-Progress Track Chairs Alejandro R. Mosteo, CUD Zaragoza, Spain amosteo@unizar.es Ruben Martins, Carnegie Mellon University, USA rubenm@andrew.cmu.edu - Tutorial Chair Maria A. Serrano, NearbyComputing, Spain maria.serrano@nearbycomputing.com - Workshop Chair Sergio Saez, Universitat Politècnica de València, Spain ssaez@disca.upv.es - Exhibition & Sponsorship Chair Ahlan Marriott, White Elephant GmbH, Switzerland ahlan@Ada-Switzerland.ch - Publicity Chair Dirk Craeynest, Ada-Belgium & KU Leuven, Belgium Dirk.Craeynest@cs.kuleuven.be - Webmaster Hai Nam Tran, University of Brest, France hai-nam.tran@univ-brest.fr - Local Chair Nuria Sirvent, Barcelona Supercomputing Center, Spain nuria.sirvent@bsc.es *** Journal Track Committee Al Mok, University of Texas at Austin, USA Alejandro Mosteo, CUD Zaragoza, Spain Alwyn Godloe, NASA, USA António Casimiro, University of Lisbon, Portugal Barbara Gallina, Mälardalen University, Sweden Bernd Burgstaller, Yonsei University, South Korea C. Michael Holloway, NASA, USA Cristina Seceleanu, Mälardalen University, Sweden Doug Schmidt, Vanderbilt University, USA Frank Singhoff, University of Brest, FR George Lima, Universidade Federal da Bahia, Brazil Isaac Amundson, Rockwell Collins, USA Jérôme Hugues, CMU/SEI, USA José Cruz, Lockeed Martin, USA Kristoffer Nyborg Gregertsen, SINTEF Digital, Norway Laurent Pautet, Telecom ParisTech, France Leonidas Kosmidis, Barcelona Supercomputing Center, Spain Mario Aldea Rivas, University of Cantabria, Spain Matthias Becker, KTH - Royal Institute of Technology, Sweden Patricia López Martínez, University of Cantabria, Spain Sara Royuela, Barcelona Supercomputing Center, Spain Sergio Sáez, Universitat Politècnica de València, Spain Tucker Taft, AdaCore, USA Tullio Vardanega, University of Padua, Italy Xiaotian Dai, University of York, England *** Industrial Track Committee Aida Causevic, Alstom, Sweden Alexander Viehl, Research Center for Information Technology, Germany Ana Rodríguez, Silver Atena, Spain Aurora Agar, NATO, Netherlands Behnaz Pourmohseni, Robert Bosch GmbH, Germany Claire Dross, AdaCore, France Elena Lisova, Volvo CE, Sweden Enricco Mezzeti, Barcelona Supercomputing Center, Spain Federico Aromolo, Scuola Superiore Sant'Anna, Italy Helder Silva, Edisoft, Portugal Hugo Torres Vieira, Evidence Srl, Italy Irune Agirre, Ikerlan, Spain Jordi Cardona, Rapita Systems, Spain José Ruiz, AdaCore, France Joyce Tokar, Raytheon, USA Luciana Alvite, Alstom, Germany Marco Panunzio, Thales Alenia Space, France Patricia Balbastre Betoret, Valencia Polytechnic University, Spain Philippe Waroquiers, Eurocontrol NMD, Belgium Raúl de la Cruz, Collins Aerospace, Ireland Santiago Urueña, GMV, Spain Stef Van Vlierberghe, Eurocontrol NMD, Belgium *** Work-in-Progress Track Committee Alan Oliveira, University of Lisbon, Portugal J. Javier Gutiérrez, University of Cantabria, Spain Jérémie Guiochet, LAAS-CNRS, France José Cecílio, University of Lisbon, Portugal Kalinka Branco, University of São Paulo, Brazil Katherine Kosaian, University of Iowa, USA Kevin Cheang, AWS, USA Kristin Yvonne Rozier, Iowa State University, USA Leandro Buss Becker, University of Manchester, UK Li-Pin Chang, National Yang Ming Chiao Tung University, Taiwan Mathias Preiner, Stanford University, USA Raffaele Romagnoli, Carnegie Mellon University, USA Robert Kaiser, RheinMain University of Applied Sciences, Germany Sara Abbaspour, Mälardalen University, Sweden Sergi Alcaide, Barcelona Supercomputing Center, Spain Simona Bernardi, Unizar, Spain Stefan Mitsch, School of Computing at DePaul University, USA Teresa Lázaro, Aragon's Institute of Technology, Spain Tiago Carvalho, ISEP, Portugal Yannick Moy, AdaCore, France *** Previous Editions Ada-Europe organizes annual international conferences since the early 80's. This is the 28th event in the Reliable Software Technologies series, previous ones being held at Montreux, Switzerland ('96), London, UK ('97), Uppsala, Sweden ('98), Santander, Spain ('99), Potsdam, Germany ('00), Leuven, Belgium ('01), Vienna, Austria ('02), Toulouse, France ('03), Palma de Mallorca, Spain ('04), York, UK ('05), Porto, Portugal ('06), Geneva, Switzerland ('07), Venice, Italy ('08), Brest, France ('09), Valencia, Spain ('10), Edinburgh, UK ('11), Stockholm, Sweden ('12), Berlin, Germany ('13), Paris, France ('14), Madrid, Spain ('15), Pisa, Italy ('16), Vienna, Austria ('17), Lisbon, Portugal ('18), Warsaw, Poland ('19), online from Santander, Spain ('21), Ghent, Belgium ('22), and Lisbon, Portugal ('23). Information on previous editions of the conference can be found at www.ada-europe.org/confs/ae. ----------------------------------------------------------------------- Our apologies if you receive multiple copies of this announcement. Please circulate widely. Dirk Craeynest, AEiC 2024 Publicity Chair Dirk.Craeynest@cs.kuleuven.be * 28th Ada-Europe Int. Conf. Reliable Software Technologies (AEiC 2024) * June 11-14, 2024, Barcelona, Spain, www.ada-europe.org/conference2024 (V5.1)
Le 19/01/2024 à 02:36, Randy Brukardt a écrit :
> "Tucker Taft" <tucker.taft@gmail.com> wrote in message
> news:afd791fa-853f-48fa-9223-759b12d4ed87n@googlegroups.com...
> On Sunday, January 14, 2024 at 6:05:45?AM UTC-5, Blady wrote:
>>> Hello,
>>>
>>> String_Access is defined in A.4.5 Unbounded-Length String Handling:
>>> 7 type String_Access is access all String;
>>>
>>> and note:
>>> 75 The type String_Access provides a (nonprivate) access type for
>>> explicit processing of unbounded-length strings.
>>>
>>> I wonder what String_Access is for and what could be "explicit
>>> processing"?
>>
>> The idea was to support the explicit use of new String'(...), X.all, and
>> Unchecked_Deallocation
>> rather than the implicit use of the heap inherent in Unbounded strings. It
>> was recognized that you
>> need a single global access type to avoid having to do conversions all over
>> the place. This
>> predated the availability of stand-alone objects of an anonymous access
>> type
>> (aka "SAOOAAATs" ;-), but those are not universally loved either. It
>> certainly cannot be
>> removed now without potentially very painful disruption of existing users.
>> It could be moved
>> to a different package without too much disruption, but I haven't seen any
>> groundswell of interest
>> in doing that either.
>
> I'm dubious that there are any such users. Certainly, in the handful of
> cases where I needed such a type, I just declared it (strong typing, you
> know?) and never thought of Ada.Strings.Unbounded as being a place to find
> such a type already defined. It is such an odd place I doubt anyone outside
> of perhaps the people who defined the type ever used it.
>
> OTOH, I agree that the compatibility impact is non-zero (anyone who did use
> it would have to change their code), and the benefit of removing the type at
> this point is close to zero (junk declarations abound in long-term Ada
> packages, what's one more; and certainly there is a lot of unused stuff in
> any particular reusable package and any particular use), so the cost-benefit
> ratio doesn't seem to make a change here worth it. An Ada successor language
> would design Ada.Strings.Unbounded rather differently (so as to be able to
> use string literals directly with the type) and probably would include
> universal character support as well, so it's hard to find an important
> reason to change this.
At least, the type String_Access could be tagged as obsolescent.
Pascal.
🖍️ 𝗙𝗿𝗲𝗲 StarTalk Young Readers Edition by Neil Tyson Review StarTalk Young Readers Edition by Neil Tyson This is working: ACCESS StarTalk Young Readers Edition by Neil Tyson KINDLE PDF EBOOK EPUB Simple Way to Read / Download StarTalk Young Readers Edition by Neil Tyson in PDF, EPub, Mobi, Kindle eBook and other supported formats. How to Read / Download StarTalk Young Readers Edition: - Click the link. - Get your file - Wish you have good luck and enjoy reading your book. This is working: ACCESS StarTalk Young Readers Edition by Neil Tyson KINDLE PDF EBOOK EPUB . . 🌐 https://thebookplace.top/9t5DTEFX/142633088X 🌐 https://thebookplace.top/kB810QqH/142633088X 🌐 https://thebookplace.top/9hU2Wz0Y/142633088X . . Read StarTalk Young Readers Edition by Neil Tyson PDF Read StarTalk Young Readers Edition by Neil Tyson Kindle Read StarTalk Young Readers Edition by Neil Tyson ePub Read StarTalk Young Readers Edition by Neil Tyson Mobi Read StarTalk Young Readers Edition by Neil Tyson Daisy Download StarTalk Young Readers Edition by Neil Tyson PDF Download StarTalk Young Readers Edition by Neil Tyson Kindle Download StarTalk Young Readers Edition by Neil Tyson ePub Download StarTalk Young Readers Edition by Neil Tyson Mobi Download StarTalk Young Readers Edition by Neil Tyson Daisy [ BOOK STARTALK YOUNG READERS EDITION by NEIL TYSON OVERVIEW ] StarTalk Young Readers Edition by Neil Tyson KINDLE PDF EBOOK EPUB. Size: 58,338 KB. StarTalk Young Readers Edition Neil Tyson pdf. StarTalk Young Readers Edition Neil Tyson read online. Neil Tyson StarTalk Young Readers Edition epub. StarTalk Young Readers Edition Neil Tyson vk. StarTalk Young Readers Edition pdf. StarTalk Young Readers Edition Neil Tyson amazon. StarTalk Young Readers Edition Neil Tyson free pdf. StarTalk Young Readers Edition Neil Tyson pdf free. StarTalk Young Readers Edition pdf Neil Tyson. StarTalk Young Readers Edition Neil Tyson epub. StarTalk Young Readers Edition Neil Tyson online. Neil Tyson StarTalk Young Readers Edition epub. StarTalk Young Readers Edition Neil Tyson epub vk. StarTalk Young Readers Edition Neil Tyson mobi. StarTalk Young Readers Edition PDF - KINDLE - EPUB - MOBI. StarTalk Young Readers Editionebook PDF EPUB, book in english language. book StarTalk Young Readers Edition in format PDF. StarTalk Young Readers Editionfree of book in format. StarTalk Young Readers Edition by Neil Tyson KINDLE PDF EBOOK EPUB. StarTalk Young Readers Edition Neil Tyson PDF. StarTalk Young Readers Edition Neil Tyson ePub. StarTalk Young Readers Edition Neil Tyson DOC. StarTalk Young Readers Edition Neil Tyson RTF. StarTalk Young Readers Edition Neil Tyson WORD. StarTalk Young Readers Edition Neil Tyson PPT. StarTalk Young Readers Edition Neil Tyson TXT. StarTalk Young Readers Edition Neil Tyson Ebook. StarTalk Young Readers Edition Neil Tyson iBooks. StarTalk Young Readers Edition Neil Tyson Kindle. StarTalk Young Readers Edition Neil Tyson Rar. StarTalk Young Readers Edition Neil Tyson Zip. StarTalk Young Readers Edition Neil Tyson Mobipocket. StarTalk Young Readers Edition Neil Tyson Mobi Online. StarTalk Young Readers Edition Neil Tyson Audiobook Online. StarTalk Young Readers Edition Neil Tyson Review Online. StarTalk Young Readers Edition Neil Tyson Read Online. StarTalk Young Readers Edition Neil Tyson Online. StarTalk Young Readers Edition by Neil Tyson KINDLE PDF EBOOK EPUB. StarTalk Young Readers Edition Exactly how an easy idea by reading can boost you to be a successful individual? Reviewing StarTalk Young Readers Edition is a quite straightforward activity. However, just how can many people be so careless to check out? They will choose to invest their downtime to chatting or hanging out. When as a matter of fact, checking out StarTalk Young Readers Edition will certainly provide you more possibilities to be effective finished with the efforts. By checking out StarTalk Young Readers Edition, you could recognize the knowledge as well as things more, not only regarding just what you receive from people to individuals. Book StarTalk Young Readers Edition will certainly be a lot more trusted. As this StarTalk Young Readers Edition, it will truly give you the smart idea to be effective. It is not only for you to be success in particular life; you can be effective in everything. The success can be begun by knowing the standard knowledge and also do actions. From the mix of knowledge and also actions, somebody could enhance their skill as well as capability. It will lead them to live as well as work much better. This is why, the pupils, employees, and even companies should have reading routine for publications. Any sort of book StarTalk Young Readers Edition will give certain knowledge to take all advantages. This is just what this StarTalk Young Readers Edition informs you. It will add even more knowledge of you to life as well as function better. StarTalk Young Readers Edition, Try it and also show it. Based upon some encounters of many people, it remains in reality that reading this StarTalk Young Readers Edition could help them making better option as well as give more encounter. If you want to be one of them, allow's purchase this book StarTalk Young Readers Edition by get accessing the book on link get access in this site. You can get the soft documents of this publication StarTalk Young Readers Edition to get access and read and deposit in your offered digital tools. Exactly what are you waiting for? Allow get this book StarTalk Young Readers Edition on-line and review them in any time and also any location you will check out. It will not encumber you to bring hefty publication StarTalk Young Readers Edition inside of your bag. [ BOOK STARTALK YOUNG READERS EDITION by NEIL TYSON REVIEW ] StarTalk Young Readers Edition Neil Tyson pdf download StarTalk Young Readers Edition Neil Tyson read online Neil Tyson StarTalk Young Readers Edition epub StarTalk Young Readers Edition Neil Tyson vk StarTalk Young Readers Edition pdf StarTalk Young Readers Edition Neil Tyson amazon StarTalk Young Readers Edition Neil Tyson free download pdf StarTalk Young Readers Edition Neil Tyson pdf free StarTalk Young Readers Edition pdf Neil Tyson StarTalk Young Readers Edition Neil Tyson epub download StarTalk Young Readers Edition Neil Tyson online Neil Tyson StarTalk Young Readers Edition epub download StarTalk Young Readers Edition Neil Tyson epub vk StarTalk Young Readers Edition Neil Tyson mobi download StarTalk Young Readers Edition PDF - KINDLE - EPUB - MOBI StarTalk Young Readers Edition download ebook PDF EPUB, book in english language [download] book StarTalk Young Readers Edition in format PDF StarTalk Young Readers Edition download free of book in format StarTalk Young Readers Edition Neil Tyson PDF StarTalk Young Readers Edition Neil Tyson ePub StarTalk Young Readers Edition Neil Tyson DOC StarTalk Young Readers Edition Neil Tyson RTF StarTalk Young Readers Edition Neil Tyson WORD StarTalk Young Readers Edition Neil Tyson PPT StarTalk Young Readers Edition Neil Tyson TXT StarTalk Young Readers Edition Neil Tyson Ebook StarTalk Young Readers Edition Neil Tyson iBooks StarTalk Young Readers Edition Neil Tyson Kindle StarTalk Young Readers Edition Neil Tyson Rar StarTalk Young Readers Edition Neil Tyson Zip StarTalk Young Readers Edition Neil Tyson Mobipocket StarTalk Young Readers Edition Neil Tyson Mobi Online StarTalk Young Readers Edition Neil Tyson Audiobook Online StarTalk Young Readers Edition Neil Tyson Review Online StarTalk Young Readers Edition Neil Tyson Read Online StarTalk Young Readers Edition Neil Tyson Download Online This is working: ACCESS StarTalk Young Readers Edition by Neil Tyson KINDLE PDF EBOOK EPUB . . 🌐 https://thebookplace.top/qERyk3Ot/142633088X 🌐 https://thebookplace.top/UkRpzpfq/142633088X 🌐 https://thebookplace.top/xWnRZckj/142633088X . . Book Information unknown Book ID Asin: 142633088X Book Title: StarTalk Young Readers Edition Book Author: Neil Tyson Book Format: unknownBook Price: unknown Book Category: unknown, unknown, unknown and unknown Book Rating: unknown Book Product Detail unknownunknownBook Review: unknown
> What's is going on? Simply no TLS certificates (see the padlock statusbefore the URL) This site is in ruins, out of date and should no longer exist. What's more, a Google search turns up some dubious links (1st page) like: http://www.adapower.com/launch.php?URL=https://telegra.ph/ceo-of-gothicc-onlyfans-leaked-01-11 -- Stéphane Rivière Ile d'Oléron - France
Hello: When I tried to access adapower.com from the last versión of Chrome and NordVPN VPN the browser show me this error: Your connection isn't private The web page you are trying to enter is not certified by a known certifying authority. Attackers might be trying to steal your information (for example, passwords, messages, or credit cards). This error did not happend with Safari or Microsoft Edge (last versión) What's is going on? Juan Miguel
"Tucker Taft" <tucker.taft@gmail.com> wrote in message
news:afd791fa-853f-48fa-9223-759b12d4ed87n@googlegroups.com...
On Sunday, January 14, 2024 at 6:05:45?AM UTC-5, Blady wrote:
>> Hello,
>>
>> String_Access is defined in A.4.5 Unbounded-Length String Handling:
>> 7 type String_Access is access all String;
>>
>> and note:
>> 75 The type String_Access provides a (nonprivate) access type for
>> explicit processing of unbounded-length strings.
>>
>> I wonder what String_Access is for and what could be "explicit
>> processing"?
>
>The idea was to support the explicit use of new String'(...), X.all, and
>Unchecked_Deallocation
>rather than the implicit use of the heap inherent in Unbounded strings. It
>was recognized that you
>need a single global access type to avoid having to do conversions all over
>the place. This
>predated the availability of stand-alone objects of an anonymous access
>type
>(aka "SAOOAAATs" ;-), but those are not universally loved either. It
>certainly cannot be
>removed now without potentially very painful disruption of existing users.
>It could be moved
>to a different package without too much disruption, but I haven't seen any
>groundswell of interest
>in doing that either.
I'm dubious that there are any such users. Certainly, in the handful of
cases where I needed such a type, I just declared it (strong typing, you
know?) and never thought of Ada.Strings.Unbounded as being a place to find
such a type already defined. It is such an odd place I doubt anyone outside
of perhaps the people who defined the type ever used it.
OTOH, I agree that the compatibility impact is non-zero (anyone who did use
it would have to change their code), and the benefit of removing the type at
this point is close to zero (junk declarations abound in long-term Ada
packages, what's one more; and certainly there is a lot of unused stuff in
any particular reusable package and any particular use), so the cost-benefit
ratio doesn't seem to make a change here worth it. An Ada successor language
would design Ada.Strings.Unbounded rather differently (so as to be able to
use string literals directly with the type) and probably would include
universal character support as well, so it's hard to find an important
reason to change this.
Also, I'm pretty sure we're discussed this within the ARG several times in
the past, so this is well-trodden ground.
Randy.
On Sunday, January 14, 2024 at 6:05:45 AM UTC-5, Blady wrote: > Hello, > > String_Access is defined in A.4.5 Unbounded-Length String Handling: > 7 type String_Access is access all String; > > and note: > 75 The type String_Access provides a (nonprivate) access type for > explicit processing of unbounded-length strings. > > I wonder what String_Access is for and what could be "explicit processing"? The idea was to support the explicit use of new String'(...), X.all, and Unchecked_Deallocation rather than the implicit use of the heap inherent in Unbounded strings. It was recognized that you need a single global access type to avoid having to do conversions all over the place. This predated the availability of stand-alone objects of an anonymous access type (aka "SAOOAAATs" ;-), but those are not universally loved either. It certainly cannot be removed now without potentially very painful disruption of existing users. It could be moved to a different package without too much disruption, but I haven't seen any groundswell of interest in doing that either. > > Thanks, Pascal. Take care, -Tuck
Le 17/01/2024 à 02:24, Randy Brukardt a écrit : > "Jeffrey R.Carter" <spam.jrcarter.not@spam.acm.org.not> wrote in message > news:uo0fs5$dja6$1@dont-email.me... >> On 2024-01-14 12:05, Blady wrote: >>> >>> String_Access is defined in A.4.5 Unbounded-Length String Handling: >>> 7 type String_Access is access all String; >>> >>> and note: >>> 75 The type String_Access provides a (nonprivate) access type for >>> explicit processing of unbounded-length strings. >>> >>> I wonder what String_Access is for and what could be "explicit >>> processing"? >> >> String_Access is a mistake that should not exist. > > I agree with Jeffrey. Whatever reason it was initially put into the package > has long since ceased to be relevant. And, as Dmitry notes, when you want > such a type, it's usually because you didn't want to use > Ada.Strings.Unbounded (or Bounded). So the placement is odd at best. > > Randy. Thanks for all your answers, This is probably a very minor subject, however I submitted it: https://github.com/Ada-Rapporteur-Group/User-Community-Input/issues/79 Pascal.
"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message
news:uo0tkt$g6av$1@dont-email.me...
...
> ... It should have been the package Standard or none.
None for me. ;-)
One really doesn't want to put anything in Standard that isn't widely
needed, as those names become hard to use in other circumstances. In
particular, declarations in Standard hide anything that is use-visible with
the same name, so adding something to Standard can be rather incompatable.
One could mitigate use-visibility problems by allowing more extensive
overloading (for instance, of objects), but that causes rare and subtle
cases where a program could change meaning without any indication. (Where a
different object would be used, for instance.) That makes that too risky a
change for Ada.
Randy.
"Jeffrey R.Carter" <spam.jrcarter.not@spam.acm.org.not> wrote in message
news:uo0fs5$dja6$1@dont-email.me...
> On 2024-01-14 12:05, Blady wrote:
>>
>> String_Access is defined in A.4.5 Unbounded-Length String Handling:
>> 7 type String_Access is access all String;
>>
>> and note:
>> 75 The type String_Access provides a (nonprivate) access type for
>> explicit processing of unbounded-length strings.
>>
>> I wonder what String_Access is for and what could be "explicit
>> processing"?
>
> String_Access is a mistake that should not exist.
I agree with Jeffrey. Whatever reason it was initially put into the package
has long since ceased to be relevant. And, as Dmitry notes, when you want
such a type, it's usually because you didn't want to use
Ada.Strings.Unbounded (or Bounded). So the placement is odd at best.
Randy.
On 2024-01-14 12:17, Jeffrey R.Carter wrote: > On 2024-01-14 12:05, Blady wrote: >> >> String_Access is defined in A.4.5 Unbounded-Length String Handling: >> 7 type String_Access is access all String; >> >> and note: >> 75 The type String_Access provides a (nonprivate) access type for >> explicit processing of unbounded-length strings. >> >> I wonder what String_Access is for and what could be "explicit >> processing"? > > String_Access is a mistake that should not exist. Well, from one point of view, surely. However I frequently need such a type because I in general refrain from using Unbounded_String. Now, would be no problem to declare it as needed, except for generics! If you have generic packages like: generic type Object_Type (<>) is private; type Object_Access_Type is access all Object_Type; You want all instances to share the same String_Access. So it is conflicting. One is true, it has no place there. It should have been the package Standard or none. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
On 2024-01-14 12:05, Blady wrote:
>
> String_Access is defined in A.4.5 Unbounded-Length String Handling:
> 7 type String_Access is access all String;
>
> and note:
> 75 The type String_Access provides a (nonprivate) access type for explicit
> processing of unbounded-length strings.
>
> I wonder what String_Access is for and what could be "explicit processing"?
String_Access is a mistake that should not exist.
--
Jeff Carter
"If you think you got a nasty taunting this time,
you ain't heard nothing yet!"
Monty Python and the Holy Grail
23
Hello, String_Access is defined in A.4.5 Unbounded-Length String Handling: 7 type String_Access is access all String; and note: 75 The type String_Access provides a (nonprivate) access type for explicit processing of unbounded-length strings. I wonder what String_Access is for and what could be "explicit processing"? Thanks, Pascal.
"Blady" <p.p11@orange.fr> wrote in message news:unucno$89u$1@dont-email.me... > Hello, > > I want to break some unit circularity definitions with access types as for > instance with record: > > type R1; > type AR1 is access R1; > type R1 is record > Data : Natural; > Next : AR1; > end record; > > In my case, I have a unit: > > package test_20240113_modr is > type R2 is record > Data : Natural; > end record; > type AR2 is access R2; > end test_20240113_modr; > > "limited withed" in: > > limited with test_20240113_modr; > package test_20240113_mods is > procedure PS1 (V : test_20240113_modr.R2); > procedure PS2 (V : test_20240113_modr.AR2); > end; > > Let's imagine the circularity, thus PS1 and PS2 definition are legal. > > Of course the following isn't legal: > > type AS1 is array (1..2) of test_20240113_modr.R2; -- illegal > > However why not with access type: > > type AS2 is array (1..2) of test_20240113_modr.AR2; -- illegal For a limited with, one only knows the syntactic declarations (we cannot assume any analysis). Therefore, we cannot know the representation of any type, including access types. Specifically, compilers may support multiple representations for access types, for a variety of reasons (the underlying machine has different representations, as on the 8086 and U2200 that we did compilers for; because additional data needs to be carried along to implement Ada semantics - GNAT did that for access to unconstrained arrays, and so on). The representation can depend upon aspect specifications, the designated subtype, and more, none of which is known at the point of a limited with. We couldn't restrict implementations to a single representation for access types, and thus limited with has to treat them the same as other types. It's necessary to declare local access types for entities that are accessed from a limited view. The reason that anonymous access types were expanded was to make that less clunky -- but I don't think it succeeded. ... > Well, I could make some code transferts from unit to another or access > conversions, that's I actually do but at heavy cost. Yup, but the alternative is worse - requiring all access types to be the most general representation (which can have a heavy performance cost). Randy.
Hello, I want to break some unit circularity definitions with access types as for instance with record: type R1; type AR1 is access R1; type R1 is record Data : Natural; Next : AR1; end record; In my case, I have a unit: package test_20240113_modr is type R2 is record Data : Natural; end record; type AR2 is access R2; end test_20240113_modr; "limited withed" in: limited with test_20240113_modr; package test_20240113_mods is procedure PS1 (V : test_20240113_modr.R2); procedure PS2 (V : test_20240113_modr.AR2); end; Let's imagine the circularity, thus PS1 and PS2 definition are legal. Of course the following isn't legal: type AS1 is array (1..2) of test_20240113_modr.R2; -- illegal However why not with access type: type AS2 is array (1..2) of test_20240113_modr.AR2; -- illegal Likewise, why not: type AS3 is record Data : Natural; Next : test_20240113_modr.AR2; -- illegal end record; Isn't "limited with" too restrictive, is it? Well, I could make some code transferts from unit to another or access conversions, that's I actually do but at heavy cost. Thanks, Pascal.
On Fri, 12 Jan 2024 05:47:41 -0400, J-P. Rosen wrote:
> Renames shouldn't be seen as a kind of macro (i.e. textual substitution
> of the LHS by the RHS).
There is the wrong way of implementing macros--by textual substitution--
and there is the right way, as done in homoiconic languages such as Lisp.
For example, the latter can give you lexical binding. That is, the rename
still refers to the original definition, even in an inner scope where that
is masked by another entity with the same name. I assume that is how the
Ada mechanism works.
Le 11/01/2024 à 11:09, Blady a écrit : > Le 11/01/2024 à 03:18, Randy Brukardt a écrit : >> "Blady" <p.p11@orange.fr> wrote in message >> news:unls1j$2f0up$3@dont-email.me... >>> I got: >>> test_20240110_renproc.adb:47:14: error: too many arguments in call to >>> "log" >>> >>> Is it a correct or a GNAT issue? >> >> Looks like a bug to me. Not too surprising, though, this sort of thing >> is a >> special case in a compiler and often added to pass an ACATS test or >> user bug >> report. Such fixes can often not be fully general. > > Thanks, I'll report it. Submitted issue with attached source code: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113351
Le 12/01/2024 à 04:59, Randy Brukardt a écrit : > "Blady" <p.p11@orange.fr> wrote in message > news:unoep3$2uqo6$2@dont-email.me... >> Le 11/01/2024 à 03:18, Randy Brukardt a écrit : >>> "Blady" <p.p11@orange.fr> wrote in message >>> news:unls1j$2f0up$3@dont-email.me... >>>> Is a procedure renaming equivalent to a simple call? >>> >>> General point: "Equivalent" is never true in programming language design. >>> If >>> construct A is equivalent in every way to construct B, then they have to >>> be >>> the same construct. >>> >>> For instance, in your example below, the two subprogram declarations have >>> different identifiers which have different visibility (two declarations >>> cannot be at exactly the same place), so there is at least one way that >>> they're not equivalent. >>> >>> So, if you want to talk about "equivalence", you need to qualify that by >>> what properties you are interested in. >> >> Well, I hadn't find a better word :-( > > You have to say something like "equivalent in run-time behavior"; > "equivalent" by itself is always False. Thanks, I like it. >>> ... >>>> What is happening if My_Generic_Handler change? >>> >>> Nothing. The names in a renaming are evaluated when the renaming is >>> declared. If there are parts that could change, the compiler has to save >>> the >>> values at the point of the renaming. That's true for all forms of >>> renaming >>> (some names, like package names, can't change meaning so the example >>> isn't >>> possible, of course). >> >> Yet, the code: >> My_Log_3 ("Hei"); >> My_Generic_Handler := My_Full_Handler'Access; >> My_Log_3 ("Hei"); >> gives: >> Hei >> Full Hei >> >> I thought that was correct, wasn't it? > > Shouldn't be correct. The "name" is evaluated during a renaming, and the > renamed entity does not change afterwards. So whatever subprogram My_Log_3 > designates for the first call should be the same for the second call. > >> GNAT issue ? > > Appears to be (of course, without seeing the full code I can't say > definitively; people here often post snippets that aren't quite the same as > the actual code they tried to run. I wouldn't expect that with you, but we > all make mistakes. :-). I quote you :-) and attached the full source code. You might follow or comment on the created issue: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113350
Le 11/01/2024 à 23:59, Randy Brukardt a écrit : > Shouldn't be correct. The "name" is evaluated during a renaming, and the > renamed entity does not change afterwards. So whatever subprogram My_Log_3 > designates for the first call should be the same for the second call. Just to make things perfectly clear (I hope): Renames shouldn't be seen as a kind of macro (i.e. textual substitution of the LHS by the RHS). It is rather like evaluating the address of the RHS thing, and storing it into the LHS. A kind of precalculated address/pointer/reference. -- J-P. Rosen Adalog 2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX https://www.adalog.fr https://www.adacontrol.fr
[-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain, Size: 2158 bytes --] "Blady" <p.p11@orange.fr> wrote in message news:unoep3$2uqo6$2@dont-email.me... > Le 11/01/2024 à 03:18, Randy Brukardt a écrit : >> "Blady" <p.p11@orange.fr> wrote in message >> news:unls1j$2f0up$3@dont-email.me... >>> Is a procedure renaming equivalent to a simple call? >> >> General point: "Equivalent" is never true in programming language design. >> If >> construct A is equivalent in every way to construct B, then they have to >> be >> the same construct. >> >> For instance, in your example below, the two subprogram declarations have >> different identifiers which have different visibility (two declarations >> cannot be at exactly the same place), so there is at least one way that >> they're not equivalent. >> >> So, if you want to talk about "equivalence", you need to qualify that by >> what properties you are interested in. > > Well, I hadn't find a better word :-( You have to say something like "equivalent in run-time behavior"; "equivalent" by itself is always False. >> ... >>> What is happening if My_Generic_Handler change? >> >> Nothing. The names in a renaming are evaluated when the renaming is >> declared. If there are parts that could change, the compiler has to save >> the >> values at the point of the renaming. That's true for all forms of >> renaming >> (some names, like package names, can't change meaning so the example >> isn't >> possible, of course). > > Yet, the code: > My_Log_3 ("Hei"); > My_Generic_Handler := My_Full_Handler'Access; > My_Log_3 ("Hei"); > gives: > Hei > Full Hei > > I thought that was correct, wasn't it? Shouldn't be correct. The "name" is evaluated during a renaming, and the renamed entity does not change afterwards. So whatever subprogram My_Log_3 designates for the first call should be the same for the second call. > GNAT issue ? Appears to be (of course, without seeing the full code I can't say definitively; people here often post snippets that aren't quite the same as the actual code they tried to run. I wouldn't expect that with you, but we all make mistakes. :-). Randy.
On 2024-01-11 11:06, Blady wrote:
>
> Yet, the code:
> My_Log_3 ("Hei");
> My_Generic_Handler := My_Full_Handler'Access;
> My_Log_3 ("Hei");
> gives:
> Hei
> Full Hei
>
> I thought that was correct, wasn't it?
Not according to my understanding, and it seems according to Brukardt's
better-informed understanding.
--
Jeff Carter
"[A] brilliant military career that after thirty
years catapulted him to the rank of corporal."
Take the Money and Run
138
Le 11/01/2024 à 03:18, Randy Brukardt a écrit : > "Blady" <p.p11@orange.fr> wrote in message > news:unls1j$2f0up$3@dont-email.me... >> Is a procedure renaming equivalent to a simple call? > > General point: "Equivalent" is never true in programming language design. If > construct A is equivalent in every way to construct B, then they have to be > the same construct. > > For instance, in your example below, the two subprogram declarations have > different identifiers which have different visibility (two declarations > cannot be at exactly the same place), so there is at least one way that > they're not equivalent. > > So, if you want to talk about "equivalence", you need to qualify that by > what properties you are interested in. Well, I hadn't find a better word :-( > ... >> What is happening if My_Generic_Handler change? > > Nothing. The names in a renaming are evaluated when the renaming is > declared. If there are parts that could change, the compiler has to save the > values at the point of the renaming. That's true for all forms of renaming > (some names, like package names, can't change meaning so the example isn't > possible, of course). Yet, the code: My_Log_3 ("Hei"); My_Generic_Handler := My_Full_Handler'Access; My_Log_3 ("Hei"); gives: Hei Full Hei I thought that was correct, wasn't it? GNAT issue ? > ... >> I got: >> test_20240110_renproc.adb:47:14: error: too many arguments in call to >> "log" >> >> Is it a correct or a GNAT issue? > > Looks like a bug to me. Not too surprising, though, this sort of thing is a > special case in a compiler and often added to pass an ACATS test or user bug > report. Such fixes can often not be fully general. Thanks, I'll report it. Pascal.
Le 10/01/2024 à 12:38, Jeffrey R.Carter a écrit : > On 2024-01-10 11:37, Blady wrote: >> procedure My_Log_3 (Msg : String) renames My_Generic_Handler.Log; > > My_Generic_Handler.Log is shorthand for My_Generic_Handler.all.Log. > According to AARM 8.5.4(5.e/5) > (http://www.ada-auth.org/standards/22aarm/html/AA-8-5-4.html), the > renaming also renames the prefixing object and passes it to calls to the > renamed subprogram: "The prefix in such a case is essentially renamed > and passed to any calls of the renamed subprogram." > > So if I understand this correctly the renaming is roughly equivalent to > > <anonymous> : Loggings.Logging renames My_Generic_Handler.all; > procedure My_Log_3 (Handler : Loggings.Logging := <anonymous>; Msg : > String) renames Loggings.Logging.Log; > > except that My_Log_3 is called with only a String parameter even when > using positional notation. > > Another way to look at it is that > > My_Log_3 ("msg"); > > is implemented as > > <anonymous>.Log (Msg => "msg"); Thanks for your useful explanation. > > What is happening if My_Generic_Handler change? > > >> type Full_Logging is new Logging with null record; >> procedure Log (Handler : Full_Logging; Msg : String); >> ... >> My_Full_Handler : aliased Loggings.Full_Logging := (Output => >> Ada.Text_IO.Current_Output); >> ... >> My_Generic_Handler := My_Full_Handler'Access; >> >> Well, logically (?), My_Log_3 follows the change and outputs with >> Full_Logging. > > No, My_Log_3 continues to call Log with My_Handler as the object, IIUC. Yet, the code: My_Log_3 ("Hei"); My_Generic_Handler := My_Full_Handler'Access; My_Log_3 ("Hei"); gives: Hei Full Hei I thought that was correct, wasn't it? Pascal.
"Blady" <p.p11@orange.fr> wrote in message news:unls1j$2f0up$3@dont-email.me... > Is a procedure renaming equivalent to a simple call? General point: "Equivalent" is never true in programming language design. If construct A is equivalent in every way to construct B, then they have to be the same construct. For instance, in your example below, the two subprogram declarations have different identifiers which have different visibility (two declarations cannot be at exactly the same place), so there is at least one way that they're not equivalent. So, if you want to talk about "equivalence", you need to qualify that by what properties you are interested in. ... > What is happening if My_Generic_Handler change? Nothing. The names in a renaming are evaluated when the renaming is declared. If there are parts that could change, the compiler has to save the values at the point of the renaming. That's true for all forms of renaming (some names, like package names, can't change meaning so the example isn't possible, of course). ... > I got: > test_20240110_renproc.adb:47:14: error: too many arguments in call to > "log" > > Is it a correct or a GNAT issue? Looks like a bug to me. Not too surprising, though, this sort of thing is a special case in a compiler and often added to pass an ACATS test or user bug report. Such fixes can often not be fully general. Randy.
"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message news:unm1m6$2ftcd$1@dont-email.me... > On 2024-01-10 11:37, Blady wrote: ... >> To my surprise (well I hoped) My_Log_3 is compiled by GNAT. >> Is it conformed to the Ada standard? > > This looks like a bug to me. ARM 8.5.4 (2/3) states that the right part of > "renames" must be a name of a callable entity. My_Generic_Handler.Log is a > procedure call which is not a callable entity name. A "prefixed view" is indeed a view of a callable entity. For instance, you can pass those as generic formal subprograms or rename them. > Renaming a callable result of a function call might be legal [and quite > funny]. I believe that is legal as well. > Disclaimer. I am not a language lawyer. I'll refrain from a pithy remark. ;-) > P.S. Specialization of subprograms would be a nice feature, though. And Ada has had a limited form of it since Ada 2005. Limited because you can only eliminate the first parameter. (Of course, you can also eliminate the first two parameters, and so on. But you can't eliminate the third parameter, although you can default it and effectively eliminate from calls. Note that a renaming can change the defaults used for a subprogram call.) Randy.
On 2024-01-10 11:37, Blady wrote: > Is a procedure renaming equivalent to a simple call? > For instance: > procedure Log (Msg : String) is > begin > Ada.Text_IO.Put_Line (Msg); > end Log; > procedure My_Log_1 (Msg : String) is > begin > Log (Msg); > end My_Log_1; > procedure My_Log_2 (Msg : String) renames Log; > > Almost, My_Log_1 is equivalent to My_Log_2, isn't it? > > Is it the same with primitives? > > For instance: > package Loggings is > type Logging is tagged record > Output : Ada.Text_IO.File_Access; > end record; > procedure Log (Handler : Logging; Msg : String); > end Loggings; > My_Handler : aliased Loggings.Logging := (Output => > Ada.Text_IO.Current_Output); > My_Generic_Handler : access Loggings.Logging'Class := > My_Handler'Access; > procedure My_Log_3 (Msg : String) renames My_Generic_Handler.Log; > > To my surprise (well I hoped) My_Log_3 is compiled by GNAT. > Is it conformed to the Ada standard? This looks like a bug to me. ARM 8.5.4 (2/3) states that the right part of "renames" must be a name of a callable entity. My_Generic_Handler.Log is a procedure call which is not a callable entity name. Renaming a callable result of a function call might be legal [and quite funny]. Disclaimer. I am not a language lawyer. P.S. Specialization of subprograms would be a nice feature, though. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
On 2024-01-10 11:37, Blady wrote: > > package Loggings is > type Logging is tagged record > Output : Ada.Text_IO.File_Access; > end record; > procedure Log (Handler : Logging; Msg : String); > end Loggings; > My_Handler : aliased Loggings.Logging := (Output => Ada.Text_IO.Current_Output); > My_Generic_Handler : access Loggings.Logging'Class := My_Handler'Access; > procedure My_Log_3 (Msg : String) renames My_Generic_Handler.Log; My_Generic_Handler.Log is shorthand for My_Generic_Handler.all.Log. According to AARM 8.5.4(5.e/5) (http://www.ada-auth.org/standards/22aarm/html/AA-8-5-4.html), the renaming also renames the prefixing object and passes it to calls to the renamed subprogram: "The prefix in such a case is essentially renamed and passed to any calls of the renamed subprogram." So if I understand this correctly the renaming is roughly equivalent to <anonymous> : Loggings.Logging renames My_Generic_Handler.all; procedure My_Log_3 (Handler : Loggings.Logging := <anonymous>; Msg : String) renames Loggings.Logging.Log; except that My_Log_3 is called with only a String parameter even when using positional notation. Another way to look at it is that My_Log_3 ("msg"); is implemented as <anonymous>.Log (Msg => "msg"); > What is happening if My_Generic_Handler change? > > type Full_Logging is new Logging with null record; > procedure Log (Handler : Full_Logging; Msg : String); > ... > My_Full_Handler : aliased Loggings.Full_Logging := (Output => > Ada.Text_IO.Current_Output); > ... > My_Generic_Handler := My_Full_Handler'Access; > > Well, logically (?), My_Log_3 follows the change and outputs with Full_Logging. No, My_Log_3 continues to call Log with My_Handler as the object, IIUC. > Unfortunately, GNAT claims renaming with several parameters. > I add: > procedure Log (Handler : Logging; Msg : String; Err : Natural); > ... > procedure My_Log_4 (Msg : String; Err : Natural) renames > My_Generic_Handler.Log; > > I got: > test_20240110_renproc.adb:47:14: error: too many arguments in call to "log" > > Is it a correct or a GNAT issue? I'm not sure what is going on here. This looks correct to me. -- Jeff Carter "Fundamental improvements in performance are most often made by algorithm changes, not by tuning." Elements of Programming Style 201
Hello, Is a procedure renaming equivalent to a simple call? For instance: procedure Log (Msg : String) is begin Ada.Text_IO.Put_Line (Msg); end Log; procedure My_Log_1 (Msg : String) is begin Log (Msg); end My_Log_1; procedure My_Log_2 (Msg : String) renames Log; Almost, My_Log_1 is equivalent to My_Log_2, isn't it? Is it the same with primitives? For instance: package Loggings is type Logging is tagged record Output : Ada.Text_IO.File_Access; end record; procedure Log (Handler : Logging; Msg : String); end Loggings; My_Handler : aliased Loggings.Logging := (Output => Ada.Text_IO.Current_Output); My_Generic_Handler : access Loggings.Logging'Class := My_Handler'Access; procedure My_Log_3 (Msg : String) renames My_Generic_Handler.Log; To my surprise (well I hoped) My_Log_3 is compiled by GNAT. Is it conformed to the Ada standard? What is happening if My_Generic_Handler change? For instance: type Full_Logging is new Logging with null record; procedure Log (Handler : Full_Logging; Msg : String); ... My_Full_Handler : aliased Loggings.Full_Logging := (Output => Ada.Text_IO.Current_Output); ... My_Generic_Handler := My_Full_Handler'Access; Well, logically (?), My_Log_3 follows the change and outputs with Full_Logging. Unfortunately, GNAT claims renaming with several parameters. I add: procedure Log (Handler : Logging; Msg : String; Err : Natural); ... procedure My_Log_4 (Msg : String; Err : Natural) renames My_Generic_Handler.Log; I got: test_20240110_renproc.adb:47:14: error: too many arguments in call to "log" Is it a correct or a GNAT issue? Full source code on demand. Thanks. Happy New Year to all! Pascal.
On Sat, 6 Jan 2024 21:21:30 -0400, J-P. Rosen wrote: > Yes, I'm always surprised to see many languages (including Rust) > praising themselves of being "concise". Apart from saving some > keystrokes, I fail to see the benefit of being concise... How about this for an example. I created a Python wrapper around the Cairo graphics library <https://www.cairographics.org/>. There are already other Python wrappers, which are little more than transliterations of the C API. I wanted to go one step further. So whereas in C you might write x1 = - scope_radius * sin(trace_width_angle); y1 = scope_radius * cos(trace_width_angle); cairo_line_to(ctx, x1, y1); my Python wrapper reduces this down to ctx.line_to(Vector(0, scope_radius).rotate(trace_width_angle)) How’s that for “concise”?
On 7 Jan 2024, J-P. Rosen wrote
(in article <uncuas$qe2g$1@dont-email.me>):
> Le 06/01/2024 à 03:03, Randy Brukardt a écrit:
> > Usability is of course not just ease-of-writing, but a lot of people tend to
> > co-mingle the two. For readability, too little information can be just as
> > bad as too much. For writability, the less you have to write, the better.
> Yes, I'm always surprised to see many languages (including Rust)
> praising themselves of being "concise". Apart from saving some
> keystrokes, I fail to see the benefit of being concise...
Agreed. However, it is a bit of a totem in the FP cult.
--
Bill Findlay
On 2024-01-09 05:46, Randy Brukardt wrote:
> "Jeffrey R.Carter" <spam.jrcarter.not@spam.acm.org.not> wrote in message
> news:uneel2$12ufr$1@dont-email.me...
>
> I don't recall ever seriously considering this (might just my memory getting
> old). I suspect that didn't get rejected so much as not making the cut as
> important enough.
I don't consider special syntax to shorten names in assignment statements
important at all. We have renames for that, and it is a more general mechanism,
applying to more than just assignments.
--
Jeff Carter
"[I]t is foolish to polish a program beyond the
point of diminishing returns, but most programmers
do too little revision; they are satisfied too
early."
Elements of Programming Style
189
On Mon, 8 Jan 2024 22:46:59 -0600, Randy Brukardt wrote:
> OTOH, we added "when condition" to loops (which I thought
> was unnecessary, but I lost that) ...
I can see that conditional exits are a very common case, and because Ada
requires “end if” on if-statements, they wanted to shorten the common
case, hence exit-when.
Not sure if conditional raises are that common. If my Python experience is
any guide, I don’t do that much.
"Jeffrey R.Carter" <spam.jrcarter.not@spam.acm.org.not> wrote in message news:uneel2$12ufr$1@dont-email.me... ... > For the 9X and 0X revisions I suggested adding "when <condition>" to > return and raise statements, similar to its use on exit statements. This > was rejected because the language already has a way to accomplish this: if > statements. I don't recall ever seriously considering this (might just my memory getting old). I suspect that didn't get rejected so much as not making the cut as important enough. We do try to limit the size of what gets added, not just adding everyone's favorite feature. I'd guess that "raise Foo when Something" would get rejected now as it would be confusing with "raise Foo with Something" which means something very different. (At least the types of "Something" are different in these two.) OTOH, we added "when condition" to loops (which I thought was unnecessary, but I lost that), so argubly it would be consistent to add it to other statements and expressions as well. Perhaps you should raise it again on the Github. Randy. > > Given that one can do > > declare > V : T renames Very_Long_Identifier; > begin > V := V - 23; > end; > > it seems that @ should also have been rejected. Probably more so, since @ > is completely new syntax rather than reusing existing syntax on some > additional statements. What is the justification of accepting @ while > still rejecting the other? > > -- > Jeff Carter > "If I could find a sheriff who so offends the citizens of Rock > Ridge that his very appearance would drive them out of town ... > but where would I find such a man? Why am I asking you?" > Blazing Saddles > 37 >
[-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain, Size: 16577 bytes --] ----------------------------------------------------------------------- UPDATED Call for Contributions 28th Ada-Europe International Conference on Reliable Software Technologies (AEiC 2024) 11-14 June 2024, Barcelona, Spain www.ada-europe.org/conference2024 *** Journal track deadline EXTENDED to 31 January 2024 *** *** Other submissions by 26 February 2024 *** Organized by Ada-Europe and Barcelona Supercomputing Center (BSC), in cooperation with ACM SIGAda, ACM SIGBED, ACM SIGPLAN, and Ada Resource Association (ARA) #AEiC2024 #AdaEurope #AdaProgramming ----------------------------------------------------------------------- *** General Information The 28th Ada-Europe International Conference on Reliable Software Technologies (AEiC 2024) will take place in Barcelona, Spain. AEiC is a leading international forum for providers, practitioners, and researchers in reliable software technologies. The conference presentations will illustrate current work in the theory and practice of the design, development, and maintenance of long-lived, high-quality software systems for a challenging variety of application domains. The program will also include keynotes, Q&A and discussion sessions, and social events. Participants include practitioners and researchers from industry, academia, and government organizations active in the development of reliable software technologies. The topics of interest for the conference include but are not limited to (more specific topics are described on the conference web page): * Formal and Model-Based Engineering of Critical Systems; * High-Integrity Systems and Reliability; * AI for High-Integrity Systems Engineering; * Real-Time Systems; * Ada Language; * Applications in Relevant Domains. The conference comprises different tracks and co-located events: * Journal track papers present research advances supported by solid theoretical foundation and thorough evaluation. * Industrial track contributions highlight industrial open challenges and/or the practitioners' side of a relevant case study or industrial project. * Work-in-progress track papers illustrate novel research ideas that are still at an initial stage, between conception and first prototype. * Tutorials guide attenders through a hands-on familiarization with innovative developments or with useful features related to reliable software. * Workshops provide discussion forums on themes related to the conference topics. * Vendor presentations and exhibitions allow for companies to showcase their latest products and services. *** Important Dates 31 January 2024 EXTENDED submission deadline for journal track papers 26 February 2024 Deadline for submission of industrial track papers, work-in-progress papers, tutorial and workshop proposals 22 March 2024 First round notification for journal track papers, and notification of acceptance for all other types of submissions 11-14 June 2024 Conference *** Call for Journal Track Submissions Following a journal-first model, this edition of the conference includes a journal track, which seeks original and high-quality papers that describe mature research work on the conference topics. Accepted journal track papers will be published in a Special Issue of Elsevier JSA - the Journal of Systems Architecture (Q1 ranked, CiteScore 8.5, impact factor 4.5). Accordingly, the conference is listed as "Journal Published" in the latest update of the CORE Conference Ranking released in August 2023. Contributions must be submitted by 31 January 2024. Submissions should be made online at https://www.editorialmanager.com/jsa/, selecting the "Ada-Europe AEiC 2024" option (submission page open from 15 November 2023) as article type of the paper. General information for submitting to the JSA can be found at the Journal of Systems Architecture website. JSA has adopted the Virtual Special Issue model to speed up the publication process, where Special Issue papers are published in regular issues, but marked as SI papers. Acceptance decisions are made on a rolling basis. Therefore, authors are encouraged to submit papers early, and need not wait until the submission deadline. Authors who have successfully passed the first round of review will be invited to present their work at the conference. The abstract of the accepted contributions will be included in the conference booklet. The Ada-Europe organization will waive the Open Access fees for the first four accepted papers (whose authors do not already enjoy Open Access agreements). Subsequent papers will follow JSA regular publishing track. Prospective authors may direct all enquiries regarding this track to the corresponding chairs, Bjorn Andersson (baandersson@sei.cmu.edu) and Luis Miguel Pinho (lmp@isep.ipp.pt). *** Call for Industrial Track Submissions The conference seeks industrial practitioner presentations that deliver insight on the challenges of developing reliable software. Especially welcome kinds of submissions are listed on the conference website. Given their applied nature, such contributions will be subject to a dedicated practitioner-peer review process. Interested authors shall submit a 1-to-2 pages abstract, by 26 February 2024, via EasyChair at https://easychair.org/my/conference?conf=aeic2024, selecting the "Industrial Track". The format for submission is strictly in PDF, following the Ada User Journal style. Templates are available at http://www.ada-europe.org/auj/guide. The abstract of the accepted contributions will be included in the conference booklet. The corresponding authors will get a presentation slot in the prime-time technical program of the conference and will also be invited to expand their contributions into full-fledged articles for publication in the Ada User Journal, which will form the proceedings of the industrial track of the Conference. Prospective authors may direct all enquiries regarding this track to its chairs Luciana Provenzano (luciana.provenzano@mdu.se) and Michael Pressler (Michael.Pressler@de.bosch.com). *** Call for Work-in-Progress Track Submissions The work-in-progress track seeks two kinds of submissions: (a) ongoing research and (b) early-stage ideas. Ongoing research submissions are 4-page papers describing research results that are not mature enough to be submitted to the journal track. Early-stage ideas are 1-page papers that pitch new research directions that fall within the scope of the conference. Both kinds of submissions must be original and shall undergo anonymous peer review. Submissions by recent MSc graduates and PhD students are especially sought. Authors shall submit their work by 26 February 2024, via EasyChair at https://easychair.org/my/conference?conf=aeic2024, selecting the "Work-in-Progress Track". The format for submission is strictly in PDF, following the Ada User Journal style. Templates are available at http://www.ada-europe.org/auj/guide. The abstract of the accepted contributions will be included in the conference booklet. The corresponding authors will get a presentation slot in the prime-time technical program of the conference and will also be offered the opportunity to expand their contributions into 4-page articles for publication in the Ada User Journal, which will form the proceedings of the WiP track of the Conference. Prospective authors may direct all enquiries regarding this track to the corresponding chairs Alejandro R. Mosteo (amosteo@unizar.es) and Ruben Martins (rubenm@andrew.cmu.edu). *** Awards The organization will offer an honorary award for the best technical presentation, to be announced in the closing session of the conference. *** Call for Tutorials The conference seeks tutorials in the form of educational seminars on themes falling within the conference scope, with an academic or practitioner slant, including hands-on or practical elements. Tutorial proposals shall include a title, an abstract, a description of the topic, an outline of the presentation, the proposed duration (half-day or full-day), the intended level of the contents (introductory, intermediate, or advanced), and a statement motivating attendance. Tutorial proposals shall be submitted at any time but no later than the 26 February 2024 to the respective chair Maria A. Serrano (maria.serrano@nearbycomputing.com), with subject line: "[AEiC 2024: tutorial proposal]". Once submitted, each tutorial proposal will be evaluated by the conference organizers as soon as possible, with decisions from January 1st. The authors of accepted full-day tutorials will receive a complimentary conference registration, halved for half-day tutorials. The Ada User Journal will offer space for the publication of summaries of the accepted tutorials. *** Call for Workshops The conference welcomes satellite workshops centred on themes that fall within the conference scope. Proposals may be submitted for half- or full-day events, to be scheduled at either end of the AEiC conference. Workshop organizers shall also commit to producing the proceedings of the event, for publication in the Ada User Journal. Workshop proposals shall be submitted at any time but no later than the 26 February 2024 to the respective chair Sergio Saez (ssaez@disca.upv.es), with subject line: "[AEiC 2024: workshop proposal]". Once submitted, each workshop proposal will be evaluated by the conference organizers as soon as possible, with decisions from January 1st. *** Academic Listing The Journal of Systems Architecture, publication venue of the journal track proceedings of the conference, is Q1 ranked, with CiteScore 8.5 and Impact Factor 4.5. The Ada User Journal, venue of all other technical proceedings of the conference, is indexed by Scopus and by EBSCOhost in the Academic Search Ultimate database. *** Call for Exhibitors and Sponsors The conference will include a vendor and technology exhibition with the option of a 20 minutes presentation as part of the conference program. Interested providers should direct inquiries to the Exhibition & Sponsorship Chair Ahlan Marriot (ahlan@ada-switzerland.ch). *** Venue The conference will take place in Barcelona, Spain. Barcelona is a major cultural, economic, and financial centre, known for its architecture, culture, and Mediterranean atmosphere, a hub for technology and innovation. There's plenty to see and visit in Barcelona, so plan in advance! *** Organizing Committee - Conference Chair Sara Royuela, Barcelona Supercomputing Center, Spain sara.royuela@bsc.es - Journal Track Chairs Bjorn Andersson, Carnegie Mellon University, USA baandersson@sei.cmu.edu Luis Miguel Pinho, ISEP & INESC TEC, Portugal lmp@isep.ipp.pt - Industrial Track Chairs Luciana Provenzano, Mälardalen University, Sweden luciana.provenzano@mdu.se Michael Pressler, Robert Bosch GmbH, Germany Michael.Pressler@de.bosch.com - Work-In-Progress Track Chairs Alejandro R. Mosteo, CUD Zaragoza, Spain amosteo@unizar.es Ruben Martins, Carnegie Mellon University, USA rubenm@andrew.cmu.edu - Tutorial Chair Maria A. Serrano, NearbyComputing, Spain maria.serrano@nearbycomputing.com - Workshop Chair Sergio Saez, Universitat Politècnica de València, Spain ssaez@disca.upv.es - Exhibition & Sponsorship Chair Ahlan Marriott, White Elephant GmbH, Switzerland ahlan@Ada-Switzerland.ch - Publicity Chair Dirk Craeynest, Ada-Belgium & KU Leuven, Belgium Dirk.Craeynest@cs.kuleuven.be - Webmaster Hai Nam Tran, University of Brest, France hai-nam.tran@univ-brest.fr - Local Chair Nuria Sirvent, Barcelona Supercomputing Center, Spain nuria.sirvent@bsc.es *** Journal Track Committee Al Mok, University of Texas at Austin, USA Alejandro Mosteo, CUD Zaragoza, Spain Alwyn Godloe, NASA, USA António Casimiro, University of Lisbon, Portugal Barbara Gallina, Mälardalen University, Sweden Bernd Burgstaller, Yonsei University, South Korea C. Michael Holloway, NASA, USA Cristina Seceleanu, Mälardalen University, Sweden Doug Schmidt, Vanderbilt University, USA Frank Singhoff, University of Brest, FR George Lima, Universidade Federal da Bahia, Brazil Isaac Amundson, Rockwell Collins, USA Jérôme Hugues, CMU/SEI, USA José Cruz, Lockeed Martin, USA Kristoffer Nyborg Gregertsen, SINTEF Digital, Norway Laurent Pautet, Telecom ParisTech, France Leonidas Kosmidis, Barcelona Supercomputing Center, Spain Mario Aldea Rivas, University of Cantabria, Spain Matthias Becker, KTH - Royal Institute of Technology, Sweden Patricia López Martínez, University of Cantabria, Spain Sara Royuela, Barcelona Supercomputing Center, Spain Sergio Sáez, Universitat Politècnica de València, Spain Tucker Taft, AdaCore, USA Tullio Vardanega, University of Padua, Italy Xiaotian Dai, University of York, England *** Industrial Track Committee Aida Causevic, Alstom, Sweden Alexander Viehl, Research Center for Information Technology, Germany Ana Rodríguez, Silver Atena, Spain Aurora Agar, NATO, Netherlands Behnaz Pourmohseni, Robert Bosch GmbH, Germany Claire Dross, AdaCore, France Elena Lisova, Volvo CE, Sweden Enricco Mezzeti, Barcelona Supercomputing Center, Spain Federico Aromolo, Scuola Superiore Sant'Anna, Italy Helder Silva, Edisoft, Portugal Hugo Torres Vieira, Evidence Srl, Italy Irune Agirre, Ikerlan, Spain Jordi Cardona, Rapita Systems, Spain José Ruiz, AdaCore, France Joyce Tokar, Raytheon, USA Luciana Alvite, Alstom, Germany Marco Panunzio, Thales Alenia Space, France Patricia Balbastre Betoret, Valencia Polytechnic University, Spain Philippe Waroquiers, Eurocontrol NMD, Belgium Raúl de la Cruz, Collins Aerospace, Ireland Santiago Urueña, GMV, Spain Stef Van Vlierberghe, Eurocontrol NMD, Belgium *** Work-in-Progress Track Committee Alan Oliveira, University of Lisbon, Portugal J. Javier Gutiérrez, University of Cantabria, Spain Jérémie Guiochet, LAAS-CNRS, France Kalinka Branco, University of São Paulo, Brazil Katherine Kosaian, University of Iowa, USA Kevin Cheang, AWS, USA Kristin Yvonne Rozier, Iowa State University, USA Leandro Buss Becker, University of Manchester, UK Li-Pin Chang, National Yang Ming Chiao Tung University, Taiwan Mathias Preiner, Stanford University, USA Raffaele Romagnoli, Carnegie Mellon University, USA Robert Kaiser, RheinMain University of Applied Sciences, Germany Sara Abbaspour, Mälardalen University, Sweden Sergi Alcaide, Barcelona Supercomputing Center, Spain Simona Bernardi, Unizar, Spain Stefan Mitsch, School of Computing at DePaul University, USA Teresa Lázaro, Aragon's Institute of Technology, Spain Tiago Carvalho, ISEP, Portugal Yannick Moy, AdaCore, France *** Previous Editions Ada-Europe organizes annual international conferences since the early 80's. This is the 28th event in the Reliable Software Technologies series, previous ones being held at Montreux, Switzerland ('96), London, UK ('97), Uppsala, Sweden ('98), Santander, Spain ('99), Potsdam, Germany ('00), Leuven, Belgium ('01), Vienna, Austria ('02), Toulouse, France ('03), Palma de Mallorca, Spain ('04), York, UK ('05), Porto, Portugal ('06), Geneva, Switzerland ('07), Venice, Italy ('08), Brest, France ('09), Valencia, Spain ('10), Edinburgh, UK ('11), Stockholm, Sweden ('12), Berlin, Germany ('13), Paris, France ('14), Madrid, Spain ('15), Pisa, Italy ('16), Vienna, Austria ('17), Lisbon, Portugal ('18), Warsaw, Poland ('19), online from Santander, Spain ('21), Ghent, Belgium ('22), and Lisbon, Portugal ('23). Information on previous editions of the conference can be found at www.ada-europe.org/confs/ae. ----------------------------------------------------------------------- Our apologies if you receive multiple copies of this announcement. Please circulate widely. Dirk Craeynest, AEiC 2024 Publicity Chair Dirk.Craeynest@cs.kuleuven.be * 28th Ada-Europe Int. Conf. Reliable Software Technologies (AEiC 2024) * June 11-14, 2024, Barcelona, Spain, www.ada-europe.org/conference2024 (V4.1)
On 2024-01-06 08:25, Randy Brukardt wrote:
>
> @ is regular in the sense that it is allowed anywhere in an expression. If
> you tried to expand the use to other contexts, you would have to
> differentiate them, which would almost certainly require some sort of
> declaration. But doing that risks making the mechanism as wordy as what it
> replaces (which obviously defeats the purpose).
>
> We looked at a number of ideas like that, but they didn't seem to help
> comprehension. In something like:
> LHS:(X(Y)) := LHS + 1;
> (where LHS is an arbitrary identifier), if the target name is fairly long,
> it could be hard to find where the name for the target is given, and in any
> case, it adds to the name space that the programmer has to remember when
> reading the source expression. That didn't seem to add to readability as
> much as the simple @ does.
>
> In any case, these things are trade-offs, and certainly nothing is absolute.
> But @ is certainly much more general than ":=+" would be, given that it
> works with function calls and array indexing and attributes and user-defined
> operations rather than just a single operator.
For the 9X and 0X revisions I suggested adding "when <condition>" to return and
raise statements, similar to its use on exit statements. This was rejected
because the language already has a way to accomplish this: if statements.
Given that one can do
declare
V : T renames Very_Long_Identifier;
begin
V := V - 23;
end;
it seems that @ should also have been rejected. Probably more so, since @ is
completely new syntax rather than reusing existing syntax on some additional
statements. What is the justification of accepting @ while still rejecting the
other?
--
Jeff Carter
"If I could find a sheriff who so offends the citizens of Rock
Ridge that his very appearance would drive them out of town ...
but where would I find such a man? Why am I asking you?"
Blazing Saddles
37
Le 06/01/2024 à 03:03, Randy Brukardt a écrit : > Usability is of course not just ease-of-writing, but a lot of people tend to > co-mingle the two. For readability, too little information can be just as > bad as too much. For writability, the less you have to write, the better. > Yes, I'm always surprised to see many languages (including Rust) praising themselves of being "concise". Apart from saving some keystrokes, I fail to see the benefit of being concise... -- J-P. Rosen Adalog 2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX https://www.adalog.fr https://www.adacontrol.fr
On Sat, 6 Jan 2024 01:03:05 -0600, Randy Brukardt wrote:
> For writability, the less you have to write, the better.
I write code for readability, and I think avoiding repetition fits into
that as well. Thus, factoring repeated sequences into a common function/
class, and just putting calls to that in all the relevant places, is, I
find, generally a Good Thing.
Bugs seem to be measured per line of code. Therefore, fewer lines of code
means fewer bugs overall.
On 2024-01-06 9:03, Randy Brukardt wrote:
> "Lawrence D'Oliveiro" <ldo@nz.invalid> wrote in message
> news:unafcg$bpv5$7@dont-email.me...
>> On Thu, 4 Jan 2024 20:00:37 -0600, Randy Brukardt wrote:
>>
>>> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message
>>> news:un64o3$3krch$1@dont-email.me...
>>>>>
>>>>>> Usability always trumps performance.
>>>>>
>>>>> That's the philosophy of languages like Python, not Ada.
>>>>
>>>> Ah, this is why Python is totally unusable? (:-))
>>>
>>> I would tend to argue that it is indeed the case that you get dubious
>>> results when you put usability first. ...
>>> http://www.rrsoftware.com/html/blog/consequences.html
>>
>> Without reading that, I would never have understood "usability" to mean
>> "ease of writing". I learned from early on in my programming career that
>> readability was more important than writability. So "using" a language
>> doesn't end with writing the code: you then have to test and debug it--
>> basically lick it into shape--then maintain it afterwards.
>
> Usability is of course not just ease-of-writing, but a lot of people tend to
> co-mingle the two. For readability, too little information can be just as
> bad as too much. For writability, the less you have to write, the better.
I feel that is too narrow a definition of writability (and perhaps you
did not intend it as a definition). Before one can start typing code,
one has to decide what to write -- which language constructs to use. A
systematically constructed, regular language like Ada makes that mental
effort easier, even if it results in more keystrokes; a plethora of
special-case syntaxes and abbreviation possibilities makes it harder.
Perhaps "writability" should even be taken to cover the whole process of
creating /correct/ code, and include all the necessary testing,
debugging and corrections until correct code is achieved. Here of course
Ada shines again, with so many coding errors caught at compile time.
"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message news:un8qgm$50cc$1@dont-email.me... > On 2024-01-05 03:00, Randy Brukardt wrote: ... > Thanks for posting this. > > I disagree with what you wrote on several points: > > 1. Your premise was that use = writing. To me using includes all aspects > of software developing and maintenance process. Writing is only a small > part of it. Perhaps I didn't make it clear enough, but my premise was that many people making suggestions for Ada confuse "ease-of-use" with "ease-of-writing". I said "mischaracterized" for a reason (and I see that "mis" was missing from the first use, so I just added that). "Ease-of-writing" is not a thing for Ada, and it isn't considered while the other aspects are weighed. And as I said in my last message, there is a difference in that writing more can help understandability, but it never helps writing. > 2. You argue for language regularity as if it were opposite to usability. > Again, it is pretty much obvious that a regular language is easier to use > in any possible sense. But not necessarily easier to write, which was the primary topic I was dealing with. > 3. Removing meaningless repetitions contributes to usability. But X := X + > Y is only one instance where Ada required such repetition. There are > others. E.g. > > if X in T'Class then > declare > XT : T'Class renames T'Class (X); > > T'Class is repeated 3 times. A discussion point is whether a new name XT > could be avoided etc. Of course, this example violates OOP dogma, and some people would argue that should be harder than following it. That's the same reason that Ada doesn't have that many implicit conversions. In this particular example, I tend to think the dogma is silly, but I don't off-hand see a way to avoid the conversion being somewhere (few implicit conversions after all). > Introducing @ for a *single* purpose contradicts the principle of > regularity. I would rather have a regular syntax for most if not all such > instances. @ is regular in the sense that it is allowed anywhere in an expression. If you tried to expand the use to other contexts, you would have to differentiate them, which would almost certainly require some sort of declaration. But doing that risks making the mechanism as wordy as what it replaces (which obviously defeats the purpose). We looked at a number of ideas like that, but they didn't seem to help comprehension. In something like: LHS:(X(Y)) := LHS + 1; (where LHS is an arbitrary identifier), if the target name is fairly long, it could be hard to find where the name for the target is given, and in any case, it adds to the name space that the programmer has to remember when reading the source expression. That didn't seem to add to readability as much as the simple @ does. In any case, these things are trade-offs, and certainly nothing is absolute. But @ is certainly much more general than ":=+" would be, given that it works with function calls and array indexing and attributes and user-defined operations rather than just a single operator. Randy.
"Lawrence D'Oliveiro" <ldo@nz.invalid> wrote in message
news:unafcg$bpv5$7@dont-email.me...
> On Thu, 4 Jan 2024 20:00:37 -0600, Randy Brukardt wrote:
>
>> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message
>> news:un64o3$3krch$1@dont-email.me...
>>>>
>>>>> Usability always trumps performance.
>>>>
>>>> That's the philosophy of languages like Python, not Ada.
>>>
>>> Ah, this is why Python is totally unusable? (:-))
>>
>> I would tend to argue that it is indeed the case that you get dubious
>> results when you put usability first. ...
>> http://www.rrsoftware.com/html/blog/consequences.html
>
> Without reading that, I would never have understood "usability" to mean
> "ease of writing". I learned from early on in my programming career that
> readability was more important than writability. So "using" a language
> doesn't end with writing the code: you then have to test and debug it--
> basically lick it into shape--then maintain it afterwards.
Usability is of course not just ease-of-writing, but a lot of people tend to
co-mingle the two. For readability, too little information can be just as
bad as too much. For writability, the less you have to write, the better.
Randy.
On Thu, 4 Jan 2024 20:00:37 -0600, Randy Brukardt wrote:
> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message
> news:un64o3$3krch$1@dont-email.me...
>>>
>>>> Usability always trumps performance.
>>>
>>> That's the philosophy of languages like Python, not Ada.
>>
>> Ah, this is why Python is totally unusable? (:-))
>
> I would tend to argue that it is indeed the case that you get dubious
> results when you put usability first. ...
> http://www.rrsoftware.com/html/blog/consequences.html
Without reading that, I would never have understood “usability” to mean
“ease of writing”. I learned from early on in my programming career that
readability was more important than writability. So “using” a language
doesn’t end with writing the code: you then have to test and debug it--
basically lick it into shape--then maintain it afterwards.
On 2024-01-05 03:00, Randy Brukardt wrote: > "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message > news:un64o3$3krch$1@dont-email.me... > ... >>> Exactly. These operations, especially slicing, have a huge impact on the >>> cost of parameter passing for arrays (whether or not they are used). And >>> that's a pretty fundamental operation. >> >> It is not slicing it is dynamically constrained arrays which are required >> anyway. A general problem of language design is how to treat statically >> known constraints effectively. > > No, it's the combination of slicing and passing arrays with unknown (at > compile-time) constraints that causes problems. As well as passing non-null pointers, discriminated objects, class-wide objects... > And it only causes problems > if you want to separate the array interface and the array implementation > (which we both want to do). In such a case, you are passing arrays with > unknown constraints and implementation. Assignable slices don't work with > that, as they require a contiguous implementation of elements. Only if the base type implementation is contiguous. A slice of a non-contiguous container is non-contiguous. If you can deal with the first you can do with the second. The crucial point is removing static constraints from the instances which Ada does on some occasions and not on others, especially for the user-defined types. > Inferfacing is using the array implementation, not the array interface. Of > course it works great, as you note Ada commingles those in a way that makes > them inseparable. To separate them, you are going to have to lose something. Sure, but the point is that the loss should never happen when constraints are static when the callee knows them. When the callee does not, then a constraint must be passed to it. >>>> Usability always trumps performance. >>> >>> That's the philosophy of languages like Python, not Ada. >> >> Ah, this is why Python is totally unusable? (:-)) > > I would tend to argue that it is indeed the case that you get dubious > results when you put usability first. Ada puts > readability/understandability, maintainability, and consistency first (along > with performance). Those attributes tend to provide usability, but not at > the cost of making things less consistent or understandable. > > I wrote an article on this topic a year and a half ago that I wanted to > publish on Ada-Auth.org. But I got enough pushback about not being "neutral" > that I never did so. (I don't think discussing why we don't do things some > other languages do is negative, but whatever.) I've put this on RR's blog at > http://www.rrsoftware.com/html/blog/consequences.html so it isn't lost. Thanks for posting this. I disagree with what you wrote on several points: 1. Your premise was that use = writing. To me using includes all aspects of software developing and maintenance process. Writing is only a small part of it. 2. You argue for language regularity as if it were opposite to usability. Again, it is pretty much obvious that a regular language is easier to use in any possible sense. 3. Removing meaningless repetitions contributes to usability. But X := X + Y is only one instance where Ada required such repetition. There are others. E.g. if X in T'Class then declare XT : T'Class renames T'Class (X); T'Class is repeated 3 times. A discussion point is whether a new name XT could be avoided etc. Introducing @ for a *single* purpose contradicts the principle of regularity. I would rather have a regular syntax for most if not all such instances. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
"Randy Brukardt" <randy@rrsoftware.com> writes:
> I wrote an article on this topic a year and a half ago that I wanted to
> publish on Ada-Auth.org. But I got enough pushback about not being "neutral"
> that I never did so. (I don't think discussing why we don't do things some
> other languages do is negative, but whatever.) I've put this on RR's blog at
> http://www.rrsoftware.com/html/blog/consequences.html so it isn't lost.
Thanks for this!
"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message news:un64o3$3krch$1@dont-email.me... ... >> Exactly. These operations, especially slicing, have a huge impact on the >> cost of parameter passing for arrays (whether or not they are used). And >> that's a pretty fundamental operation. > > It is not slicing it is dynamically constrained arrays which are required > anyway. A general problem of language design is how to treat statically > known constraints effectively. No, it's the combination of slicing and passing arrays with unknown (at compile-time) constraints that causes problems. And it only causes problems if you want to separate the array interface and the array implementation (which we both want to do). In such a case, you are passing arrays with unknown constraints and implementation. Assignable slices don't work with that, as they require a contiguous implementation of elements. You could work around that in various ways (passing slices by copy-result, passing an assignment routine along with the parameter), but all of them have substantial performance impacts that would make traditional array implementations much slower. > Ada arrays are pretty good to me. Note, I am saying that after years of > using Ada arrays for interfacing C! Yes, I would like having more support > for flattening arrays, but the mere fact that Ada can interface C using > *in-place* semantics invalidates your point. Inferfacing is using the array implementation, not the array interface. Of course it works great, as you note Ada commingles those in a way that makes them inseparable. To separate them, you are going to have to lose something. I chose slices and other array-specific operations as a built-in as that something. YMMV. ... >>> Usability always trumps performance. >> >> That's the philosophy of languages like Python, not Ada. > > Ah, this is why Python is totally unusable? (:-)) I would tend to argue that it is indeed the case that you get dubious results when you put usability first. Ada puts readability/understandability, maintainability, and consistency first (along with performance). Those attributes tend to provide usability, but not at the cost of making things less consistent or understandable. I wrote an article on this topic a year and a half ago that I wanted to publish on Ada-Auth.org. But I got enough pushback about not being "neutral" that I never did so. (I don't think discussing why we don't do things some other languages do is negative, but whatever.) I've put this on RR's blog at http://www.rrsoftware.com/html/blog/consequences.html so it isn't lost. Randy.
On 2024-01-04 05:07, Randy Brukardt wrote: > "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message > news:un3bg9$35mhv$1@dont-email.me... [...] >> Yes, ordering is an ability to enumerate elements of a set. It is not an >> artifact it is the sole semantics of. > > Iteration is not necessarily enumeration. It is applying an operation to all > elements, and doing that does not require an order. That is not iteration, it is unordered listing, a totally useless thing because the result is the same unordered set. You could not implement it without prior ordering of the elements you fed to the threads. If the threads picked up elements concurrently there would be no way to do that without ordering elements into a taken / not yet taken order. Hell, you cannot even get an element from a truly unordered set, no way! If the programmer tried to make any use of the listing he would again have to impose ordering when collecting results per some shared object. The unordered listing is a null operation without ordering. >> The key difference is that index does not refer any element. It is >> container + index that do. > > That's not a "key difference". That exactly how one should use cursors, > especially in Ada 2022. The Ada containers do have cursor-only operations, > but those should be avoided since it is impossible to provide useful > contracts for those operations (the container is unknown, so the world can > be modified, which is bad for parallelism and understanding). Best to > consider those operations obsolete. (Note that I was *always* against the > cursor-only operations in the containers.) > > So, using a cursor implies calling an operation that includes the container > of its parameter. OK. It is some immensely over-designed index operation, then! (:-)) So, my initial question is back, why all that overhead? When you cannot do elementary things like preserving your indices from a well-defined set of upon deleting elements with indices outside that set? >>>> I don't see anything that is not already there. What are reasons for not >>>> providing: >>>> >>>> M (n) [ e.g. M (n).Key, M (n).Value ] >>>> M (n1..n2) [ in mutable contexts too ] >>>> M'First >>>> M'Last >>>> M1 & M2 [ M1 or M2 ] >>>> >>>> They are all well-defined and useful operations. >>> >>> Performance. >> >> Irrelevant so long it does not tamper implementations of other operations. > > Exactly. These operations, especially slicing, have a huge impact on the > cost of parameter passing for arrays (whether or not they are used). And > that's a pretty fundamental operation. It is not slicing it is dynamically constrained arrays which are required anyway. A general problem of language design is how to treat statically known constraints effectively. Ada arrays are pretty good to me. Note, I am saying that after years of using Ada arrays for interfacing C! Yes, I would like having more support for flattening arrays, but the mere fact that Ada can interface C using *in-place* semantics invalidates your point. > Specifically, the containers are separate from Ada. Not really. Like STL with C++ it massively influenced the language design motivating adding certain language features and shifting general language paradigm in certain direction. >> Usability always trumps performance. > > That's the philosophy of languages like Python, not Ada. Ah, this is why Python is totally unusable? (:-)) Ada is usable and performant because of right abstractions it deploys. If you notice performance problems then, maybe, just my guess, you are using a wrong abstraction? >> And again, looking at the standard containers and all these *tagged* >> *intermediate* objects one needs in order to do elementary things, I kind >> of in doubts... (:-)) > > The standard containers were designed to make *safe* containers with decent > performance. Well, we always wish the best... (:-)) -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message news:un3bg9$35mhv$1@dont-email.me... > On 2024-01-03 04:15, Randy Brukardt wrote: >> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message >> news:umotm2$18lqm$1@dont-email.me... ... > The meaning of the word "iterate" is doing something (e.g. visiting an > element) again. That *is* an order. The order is an artifact. One logically visits all of the elements at the same time (certainly in an unordered container like a general map). >> Indeed, logically, all of >> the elements are presented at the same time (and parallel iteration >> provides >> an approximation of that). > > Parallel iteration changes nothing because involved tasks are enumerated > and thus ordered as well. Nonsense. There is no interface in Ada to access logical threads (the ones created by the parallel keyword). >> If you try to enforce an order on things that don't require it, you end >> up >> preventing useful parallelism (practically, at least, no one has >> succeeded >> at providing useful parallelism to sequential code and people have been >> trying for about 50 years -- they were trying when I was a university >> student in the late 1970s). > > Ordering things does not prevent parallelism. Yes it does, because it adds unnecessary constraints. It's those constraints that make parallelizing normal sequenatial code hard. A parallelizer has to guess which ones are fundamental to the code meaning and which ones are not. ... >> Ordering is a separate concept, not always >> needed (certainly not in basic structures like maps, sets, and bags). > > Right. But no ordering means no iteration, no foreach etc. If I can > iterate, that I can create an ordered set of (counter, element) pairs. > Done. > >>> Yes position is a property of enumeration. >> >> Surely not. This is a basis for my disagrement with you here. > > Then you are disagreeing with core mathematics... (:-)) You are adding an unnecessary property to the concept of iteration. Iteration does not necessarily imply enumeration (it can, of course). Iteration /= enumeration. ... >> The order is >> an artifact of doing it an inherently parallel operation sequentally. > > Yes, ordering is an ability to enumerate elements of a set. It is not an > artifact it is the sole semantics of. Iteration is not necessarily enumeration. It is applying an operation to all elements, and doing that does not require an order. Some specific operations might require an order, and clearly for those one needs to use a data structure that inherently has an order. ... >> So long as you are using arrays, you are using referential semantics. The >> only way to avoid it is to directly embed an object directly in an >> enclosing >> object (as in a record), and that doesn't work for many problems. > > The key difference is that index does not refer any element. It is > container + index that do. That's not a "key difference". That exactly how one should use cursors, especially in Ada 2022. The Ada containers do have cursor-only operations, but those should be avoided since it is impossible to provide useful contracts for those operations (the container is unknown, so the world can be modified, which is bad for parallelism and understanding). Best to consider those operations obsolete. (Note that I was *always* against the cursor-only operations in the containers.) So, using a cursor implies calling an operation that includes the container of its parameter. > From the programming POV it is about avoiding hidden states when you try > to sweep the container part under the rug. That's easily avoided -- don't use the obsolete operations. (And a style tool like Jean-Pierre's can enforce that for you.) >>> I don't see anything that is not already there. What are reasons for not >>> providing: >>> >>> M (n) [ e.g. M (n).Key, M (n).Value ] >>> M (n1..n2) [ in mutable contexts too ] >>> M'First >>> M'Last >>> M1 & M2 [ M1 or M2 ] >>> >>> They are all well-defined and useful operations. >> >> Performance. > > Irrelevant so long it does not tamper implementations of other operations. Exactly. These operations, especially slicing, have a huge impact on the cost of parameter passing for arrays (whether or not they are used). And that's a pretty fundamental operation. >> If all of these things are user-definable, then one has to use >> subprogram calls to implement all of them. That can be very expensive, >> particularly in the case of mutable operations (and mutable slices are >> the >> worst of all). > > But better, faster, safer when implemented ad-hoc by the programmer? As with all programming problems, you can only have two of the three. ;-) If the underlying programming language is already better and safer, that extends to user-written operations. (If it doesn't, it is a failure.) ... ... >> I think it is much better to get rid of most of these operations as >> built-in >> things and just let the programmer build their own operations as needed. > > Well, if you'd proposed throwing containers out the standard library I > would believe that you believe in that... (:-)) The standard library is not part of the programming language. It's a necessary adjunct, but it could be completely replaced without changing the language at all. It's necessary mainly so that basic operations are provided in the same way by all implementations, but there is little requirement to use it. Specifically, the containers are separate from Ada. Plenty of programmers use their own container libraries, with different performance and safety profiles. That's expected and intended. There is no one-size-fits-all (or even one-size-fits-many) container library. >> That keeps the cost confined to those who use them. Distributed overhead >> is >> the worst kind, and slices in particular have a boatload of that >> overhead. > > Usability always trumps performance. That's the philosophy of languages like Python, not Ada. If you truly believe this, then you shouldn't be using Ada at all, since it makes lots of compromises to usability in order to get performance. > And again, looking at the standard containers and all these *tagged* > *intermediate* objects one needs in order to do elementary things, I kind > of in doubts... (:-)) The standard containers were designed to make *safe* containers with decent performance. As I noted, they're not a built-in part of the programming language, and as such have no impact on the performance of the language proper. One could easily replace them with an unsafe design to get maximum performance -- but that would have to return pointers to elements, and you've said you don't like referential semantics. So you would never use those. You also can avoid all of the "tagged objects" (really controlled objects) by using function Element to get a copy of the element rather than some sort of reference to it. That's preferred if it doesn't cost too much for your application. Randy.
On 2024-01-03 04:15, Randy Brukardt wrote: > "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message > news:umotm2$18lqm$1@dont-email.me... > ... >>> Only as far as there is an order implied by the order that things are >>> returned. That order doesn't have any meaning, and certainly there isn't >>> any >>> such thing as "forward" or "reverse" to it. (Which was the original >>> claim, >>> after all.) There is no "natural" order to the key/element pairs; they >>> are >>> effectively unordered. >> >> Iteration = order. It is the same thing. If you provide iteration of pairs >> in the mapping by doing so you provide an order of. > > Certainly not. An iteration presents all of the elements in a container, but > there is no requirement that there is an order. The meaning of the word "iterate" is doing something (e.g. visiting an element) again. That *is* an order. > Indeed, logically, all of > the elements are presented at the same time (and parallel iteration provides > an approximation of that). Parallel iteration changes nothing because involved tasks are enumerated and thus ordered as well. > If you try to enforce an order on things that don't require it, you end up > preventing useful parallelism (practically, at least, no one has succeeded > at providing useful parallelism to sequential code and people have been > trying for about 50 years -- they were trying when I was a university > student in the late 1970s). Ordering things does not prevent parallelism. But storing cursors for later is a mother of all Sequentialisms! (:-)) Whether a container elements can be effectively deleted in parallel is an interesting but rather unpractical one. Nobody, literally nobody, cares because any implementation would be many times slower than the worst sequential one! (:-)) >>>> It always does sense *IF* enumeration (needed for iteration) is >>>> provided. >>>> Enumeration of pairs (<key>, <value>) is not same as ordering values by >>>> the keys. >>> >>> True, but it doesn't imply any particular ordering. Certainly, no concept >>> of >>> "forward" or "reverse" applies to such an ordering (nor any stability >>> requirement). >> >> It does. You have a strict total order of pairs which guarantees existence >> of previous and next pairs according to. > > Again, this is unrelated. Iteration can usefully occur in unordered > containers (that is, "foreach"). "An enumeration is a complete, ordered listing of all the items in a collection." -- Wikipedia If "foreach" exposes an arbitrary ordering rather than some meaningful (natural) one, that speaks for "insanity" but changes nothing. > Ordering is a separate concept, not always > needed (certainly not in basic structures like maps, sets, and bags). Right. But no ordering means no iteration, no foreach etc. If I can iterate, that I can create an ordered set of (counter, element) pairs. Done. >> Yes position is a property of enumeration. > > Surely not. This is a basis for my disagrement with you here. Then you are disagreeing with core mathematics... (:-)) > The only > requirement for enumeration is that all elements are produced. Produced in an order. Elements only produced" is merely an opaque set. Enumeration of that set is ordering its elements. > The order is > an artifact of doing it an inherently parallel operation sequentally. Yes, ordering is an ability to enumerate elements of a set. It is not an artifact it is the sole semantics of. [...] >>> You have some problem with an iterator >>> interface as opposed to an array interface?? >> >> Yes, I am against pointers (referential semantics) in general. > > This is nonsense - virtually everything is referential semantics (other than > components). Array indexes are just a poor mans pointer (indeed, I learned > how to program in Fortran 66 initially, and way one built useful data > structures was to use array indexes as stand-ins for pointers). In A(1), 1 > is a reference to the first component of A. > > So long as you are using arrays, you are using referential semantics. The > only way to avoid it is to directly embed an object directly in an enclosing > object (as in a record), and that doesn't work for many problems. The key difference is that index does not refer any element. It is container + index that do. From the programming POV it is about avoiding hidden states when you try to sweep the container part under the rug. >> I don't see anything that is not already there. What are reasons for not >> providing: >> >> M (n) [ e.g. M (n).Key, M (n).Value ] >> M (n1..n2) [ in mutable contexts too ] >> M'First >> M'Last >> M1 & M2 [ M1 or M2 ] >> >> They are all well-defined and useful operations. > > Performance. Irrelevant so long it does not tamper implementations of other operations. > If all of these things are user-definable, then one has to use > subprogram calls to implement all of them. That can be very expensive, > particularly in the case of mutable operations (and mutable slices are the > worst of all). But better, faster, safer when implemented ad-hoc by the programmer? See how this thread started. An elementary task, solved in a most inefficient, crude and unmaintainable way... > Moreover, since one would want the ability to have generic > and runtime parameters that only meet this interface (and the ability to > pass slices to subprograms that take unconstrained array parameters), you > would have to be able to pass all of these subprograms along with > parameters, even when you don't need them. That would make array operations > far more expensive than they are today. Yes, and the language separates mutable and immutable stuff when using containers already. You cannot get around this issue. > I think it is much better to get rid of most of these operations as built-in > things and just let the programmer build their own operations as needed. Well, if you'd proposed throwing containers out the standard library I would believe that you believe in that... (:-)) > That keeps the cost confined to those who use them. Distributed overhead is > the worst kind, and slices in particular have a boatload of that overhead. Usability always trumps performance. And again, looking at the standard containers and all these *tagged* *intermediate* objects one needs in order to do elementary things, I kind of in doubts... (:-)) -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
On 03/01/2024 03:22, Randy Brukardt wrote:
> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message
> news:umv8rg$2b4on$1@dont-email.me...
> ...
>> It is same benefit Ada arrays have over C's T* pointers and arithmetic of.
>> Cursor is merely a fat pointer.
>
> A cursor is an abstract reference. It *might* be implemented with a pointer
> or with an array index. Indeed, the bounded containers pretty much have to
> be implemented with an underlying array.
>
> It would be nice if there was some terminology for abstract references that
> hadn't been stolen by some programming language. Terms like "pointer" and
> "access" and "reference" all imply an implementation strategy. That's not
> relevant most of the time, and many programming language design mistakes
> follow from that. (Anonymous access types come to mind).
What about "currency", as used in DB systems?
--
Bill F.
"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message
news:umv8rg$2b4on$1@dont-email.me...
...
> It is same benefit Ada arrays have over C's T* pointers and arithmetic of.
> Cursor is merely a fat pointer.
A cursor is an abstract reference. It *might* be implemented with a pointer
or with an array index. Indeed, the bounded containers pretty much have to
be implemented with an underlying array.
It would be nice if there was some terminology for abstract references that
hadn't been stolen by some programming language. Terms like "pointer" and
"access" and "reference" all imply an implementation strategy. That's not
relevant most of the time, and many programming language design mistakes
follow from that. (Anonymous access types come to mind).
Randy.
"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message news:umotm2$18lqm$1@dont-email.me... ... >> Only as far as there is an order implied by the order that things are >> returned. That order doesn't have any meaning, and certainly there isn't >> any >> such thing as "forward" or "reverse" to it. (Which was the original >> claim, >> after all.) There is no "natural" order to the key/element pairs; they >> are >> effectively unordered. > > Iteration = order. It is the same thing. If you provide iteration of pairs > in the mapping by doing so you provide an order of. Certainly not. An iteration presents all of the elements in a container, but there is no requirement that there is an order. Indeed, logically, all of the elements are presented at the same time (and parallel iteration provides an approximation of that). If you try to enforce an order on things that don't require it, you end up preventing useful parallelism (practically, at least, no one has succeeded at providing useful parallelism to sequential code and people have been trying for about 50 years -- they were trying when I was a university student in the late 1970s). >>> It always does sense *IF* enumeration (needed for iteration) is >>> provided. >>> Enumeration of pairs (<key>, <value>) is not same as ordering values by >>> the keys. >> >> True, but it doesn't imply any particular ordering. Certainly, no concept >> of >> "forward" or "reverse" applies to such an ordering (nor any stability >> requirement). > > It does. You have a strict total order of pairs which guarantees existence > of previous and next pairs according to. Again, this is unrelated. Iteration can usefully occur in unordered containers (that is, "foreach"). Ordering is a separate concept, not always needed (certainly not in basic structures like maps, sets, and bags). ... > True, an operation may invalidate whatever invariants. It applies equally > to any orders, any cursors and pointers, any hidden states of pending > foreach operations. Sanity means which invariants the implementation > keeps. Ada requires that cursors continue to designate the same element through all operations other than deletion of the element or movement to a different container. Specific containers have additional invariants, but this is the most general one. No other requirement is needed in many cases. ... >> "Position" is not a property of an (abstract) map. That's my complaint >> about >> looking at everything as an array -- one starts thinking in terms of >> properties that things don't have (or need). > > Yes position is a property of enumeration. Surely not. This is a basis for my disagrement with you here. The only requirement for enumeration is that all elements are produced. The order is an artifact of doing it an inherently parallel operation sequentally. We don't care about or depend on artifacts. ... > It is the reverse. Iterators is secondary to the order. Iterator walks > pairs in the order of pairs = in the order their positions. Nope, this is completely wrong. Once you start with a bogus premise, of course you will get all kinds of bogus conclusions!! ... >> You have some problem with an iterator >> interface as opposed to an array interface?? > > Yes, I am against pointers (referential semantics) in general. This is nonsense - virtually everything is referential semantics (other than components). Array indexes are just a poor mans pointer (indeed, I learned how to program in Fortran 66 initially, and way one built useful data structures was to use array indexes as stand-ins for pointers). In A(1), 1 is a reference to the first component of A. So long as you are using arrays, you are using referential semantics. The only way to avoid it is to directly embed an object directly in an enclosing object (as in a record), and that doesn't work for many problems. ... > I don't see anything that is not already there. What are reasons for not > providing: > > M (n) [ e.g. M (n).Key, M (n).Value ] > M (n1..n2) [ in mutable contexts too ] > M'First > M'Last > M1 & M2 [ M1 or M2 ] > > They are all well-defined and useful operations. Performance. If all of these things are user-definable, then one has to use subprogram calls to implement all of them. That can be very expensive, particularly in the case of mutable operations (and mutable slices are the worst of all). Moreover, since one would want the ability to have generic and runtime parameters that only meet this interface (and the ability to pass slices to subprograms that take unconstrained array parameters), you would have to be able to pass all of these subprograms along with parameters, even when you don't need them. That would make array operations far more expensive than they are today. I think it is much better to get rid of most of these operations as built-in things and just let the programmer build their own operations as needed. That keeps the cost confined to those who use them. Distributed overhead is the worst kind, and slices in particular have a boatload of that overhead. Randy.
On 2024-01-02 17:40, G.B. wrote: > On 01.01.24 21:55, Dmitry A. Kazakov wrote: > >>> Would it not be possible to get these benefits using a different >>> approach? I think the use case is clearly stated: >>> >>> First, find Cursors in map =: C*. >>> Right after that, Delete from map all nodes referred to by C*. >> >> Right. Find cursors, store cursors in another container, iterate that >> container deleting elements of the first. Now, consider that the >> cursors in the second container become invalid (dangling pointers). If >> you wanted to delete them immediately from the second container, you >> would return the square one! (:-)) > > OK, yet if indicating nodes in a container is designed to survive > any deletions, leaving nothing dangling i.e., doesn't this limit > the way in which implementations can store nodes? Unless the container keeps references to all pointers and corrects them as necessary. Which basically defeats the only advantage of pointers. They have O(1) complexity in large non-contiguous containers while positions without caching are likely O(log(n)). > Seems like every "pointer" (= (Container, Position)) needs to know > its element, and/or the container will have to equip its storage > management with a "vacuuming" algorithm accordingly. > > Transactions seem more flexible (a locking flag in a sequential > algorithm?), a dedicated operation looks simpler than both. For large and persistent containers. But that requires a lot of work for the client and it is slow and resource consuming on the container side. A general-purpose container must be as simple as tooth powder. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
On 01.01.24 21:55, Dmitry A. Kazakov wrote:
>> Would it not be possible to get these benefits using a different
>> approach? I think the use case is clearly stated:
>>
>> First, find Cursors in map =: C*.
>> Right after that, Delete from map all nodes referred to by C*.
>
> Right. Find cursors, store cursors in another container, iterate that container deleting elements of the first. Now, consider that the cursors in the second container become invalid (dangling pointers). If you wanted to delete them immediately from the second container, you would return the square one! (:-))
OK, yet if indicating nodes in a container is designed to survive
any deletions, leaving nothing dangling i.e., doesn't this limit
the way in which implementations can store nodes?
Seems like every "pointer" (= (Container, Position)) needs to know
its element, and/or the container will have to equip its storage
management with a "vacuuming" algorithm accordingly.
Transactions seem more flexible (a locking flag in a sequential
algorithm?), a dedicated operation looks simpler than both.
On 2024-01-01 20:27, G.B. wrote: > On 29.12.23 17:52, Dmitry A. Kazakov wrote: > >>> Suppose that there is a way of orderly proceeding from one item to >>> the next. >>> It is probably known to the implementation of map. Do single steps >>> guarantee transitivity, though, so that an algorithm can assume the >>> order to be invariable? >> >> An insane implementation can expose random orders each time. > > An implementation order should then not be exposed, right? IMO, an order should be exposed. Not necessarily the "implementation order" whatever that might mean. > What portable benefits would there be when another interface > is added to that of map, i.e., to Ada containers for general use? It is same benefit Ada arrays have over C's T* pointers and arithmetic of. Cursor is merely a fat pointer. > Would it not be possible to get these benefits using a different > approach? I think the use case is clearly stated: > > First, find Cursors in map =: C*. > Right after that, Delete from map all nodes referred to by C*. Right. Find cursors, store cursors in another container, iterate that container deleting elements of the first. Now, consider that the cursors in the second container become invalid (dangling pointers). If you wanted to delete them immediately from the second container, you would return the square one! (:-)) With a positional access interface it would be just (pure Ada 95): for Index in reverse 1..Number_Of_Elements (Container) loop if Want_To_Delete (Get (Container (Index))) then Delete (Container, Index); end if; end loop; > For deleting, this thread has shown a loop that calls Delete > multiple times right after collecting the cursors. > And it is boilerplate text. Could Maps be improved for this use case? See above. > [Bulk deletion] We do get bulk insertion in containers. Also, > A.18.2 already has bulk Delete operations. Similarly, > the Strings packages have them. > > [No thread safety needed] If standard Ada maps are usually operated > by just one task, stability of Cursors is predictable. > > Then, with or without automatic management of storage, > when My_Map is from an instance of Ordered_Map, > > Start := In_13th_Floor (My_Map.Ceiling (13.0)); > Finish := In_13th_Floor (My_Map.Floor (Fxd'Pred (14.0))); > My_Map.Delete ( > From => Start, > Through => Finish); The case is more general: delete pairs satisfying certain criterion. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
On 29.12.23 17:52, Dmitry A. Kazakov wrote: >> Suppose that there is a way of orderly proceeding from one item to the next. >> It is probably known to the implementation of map. Do single steps >> guarantee transitivity, though, so that an algorithm can assume the >> order to be invariable? > > An insane implementation can expose random orders each time. An implementation order should then not be exposed, right? What portable benefits would there be when another interface is added to that of map, i.e., to Ada containers for general use? Would it not be possible to get these benefits using a different approach? I think the use case is clearly stated: First, find Cursors in map =: C*. Right after that, Delete from map all nodes referred to by C*. > Unless removing element invalidates all cursors. Look, insanity has no bounds. Cursors AKA pointers are as volatile as positions in certain implementations. Consider a garbage collector running after removing a pair and shuffling remaining pairs in memory. > >> Maybe the bulk operations of some DBMS' programming >> interfaces work just like this, for practical reasons. >> Ada 202x' Ordered_Maps might want to add a feature ;-) >> >> procedure Delete (Container : in out Map; >> From : in out Cursor; >> To : in out Cursor); > > Here you assume that cursors are ordered and the order is preserved from call to call. Even if From and To are stable the range From..To can include random pairs in between. Yes, given the descriptions of Ordered_Maps, so long as there is no tampering, a Cursor will respect an order. Likely the one that the programmer has in mind. For deleting, this thread has shown a loop that calls Delete multiple times right after collecting the cursors. And it is boilerplate text. Could Maps be improved for this use case? [Bulk deletion] We do get bulk insertion in containers. Also, A.18.2 already has bulk Delete operations. Similarly, the Strings packages have them. [No thread safety needed] If standard Ada maps are usually operated by just one task, stability of Cursors is predictable. Then, with or without automatic management of storage, when My_Map is from an instance of Ordered_Map, Start := In_13th_Floor (My_Map.Ceiling (13.0)); Finish := In_13th_Floor (My_Map.Floor (Fxd'Pred (14.0))); My_Map.Delete ( From => Start, Through => Finish); where function In_13th_Floor (C : Cursor) return Cursor -- C, if the key at C is in [13.0, 14.0), No_Element otherwise should therefore do the right thing, in that nothing is left to chance.
Le 30/12/2023 à 07:29, Randy Brukardt a écrit :
> "DrPi" <314@drpi.fr> wrote in message
> news:ummj1i$e64$1@rasp.pasdenom.info...
> ... (Example eliminated)
>
>> That's what I did but I saved the keys (String) instead of the cursors.
>> Does it make a difference ? Performance maybe ?
>
> It certainly will make a performance difference; whether that difference is
> significant of course depends on the implementation. There's two parts to it
> (one of which I thought of yesterday and the other which I forgot):
> (1) The cost of storing keys vs. storing cursors. Cursors are going to be
> implemented as small record types (cannonically, they are two pointers, one
> to the enclosing container and one to the specific node/element). A key can
> be most anything, and storing that can be more costly.
> (2) The cost of looking up a key. A map is a set of nodes, and there
> needs to be some operation to associate a key with the correct node. Those
> operations take some time, of course: for a hashed map, the key has to be
> hashed and then some sort of lookup performed. Whereas a cursor generally
> contains an indication of the node, so the access is more direct.
>
> For a lot of applications, this difference won't matter enough to be
> significant. But I'd probably lean toward using cursors for this sort of job
> as that would minimize performance problems down the line. (Of course, if
> the container gets modified after you save the cursors, then they could
> become dangling, which is a problem of it's own. If that's a possibility,
> saving the keys is better.)
>
I modified my code to use cursors.
Thanks for your help.
Nicolas
On 2023-12-30 08:21, Randy Brukardt wrote: > "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message > news:umm4r5$ppag$1@dont-email.me... >> On 2023-12-29 04:20, Randy Brukardt wrote: >>> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message >>> news:umk6ds$e9hc$1@dont-email.me... >>> ... >>>> Provided a sane implementation of map. >>>> >>>> 1. It is safe to loop over the map items in the *reverse* order of, >>>> deleting whatever items. >>> >>> A sane implementation of a map does not have/require an ordering of keys. >> >> Yes, but iterating a map requires ordering regardless properties of the >> keys. > > Only as far as there is an order implied by the order that things are > returned. That order doesn't have any meaning, and certainly there isn't any > such thing as "forward" or "reverse" to it. (Which was the original claim, > after all.) There is no "natural" order to the key/element pairs; they are > effectively unordered. Iteration = order. It is the same thing. If you provide iteration of pairs in the mapping by doing so you provide an order of. >> It always does sense *IF* enumeration (needed for iteration) is provided. >> Enumeration of pairs (<key>, <value>) is not same as ordering values by >> the keys. > > True, but it doesn't imply any particular ordering. Certainly, no concept of > "forward" or "reverse" applies to such an ordering (nor any stability > requirement). It does. You have a strict total order of pairs which guarantees existence of previous and next pairs according to. > Practically, you'll get the same order each time if the > container isn't modified, but if it is, all bets are off. (If the container > is changed by element addition or deletion, the index may get rebuilt [hash > table reconstructed if too full, tree-index rebalanced, etc.] and that can > change the iteration order dramatically.) True, an operation may invalidate whatever invariants. It applies equally to any orders, any cursors and pointers, any hidden states of pending foreach operations. Sanity means which invariants the implementation keeps. I would argue that for general-case containers keeping iterators/pointers and hidden states would be far more difficult than keeping an order. >> No. First, it is two different interfaces. A view of a map as: >> >> 1. An ordered set of pairs (<key>, <value>) > > This is not a map (in general). There is an *unordered* set of pairs. You > can retrieve them all, but the order that is done is meaningless and is an > artifact of the implementation. There's a reason that maps don't have > reverse iterators. Unless you provide iteration of the map. Most applications want iteratable maps. Then a finite maps is still iteratable regardless best efforts, though by crude means. E.g. once have an array (ordered set) of keys, you are done. >> 2. A mapping <key> -> <value> >> >> Second, the point is that both are array interfaces. The first has >> position as the index, the second has the key as the index. > > "Position" is not a property of an (abstract) map. That's my complaint about > looking at everything as an array -- one starts thinking in terms of > properties that things don't have (or need). Yes position is a property of enumeration. >> Both are invariant to removal a pair and any *sane* implementation must be >> OK with that. > > The only sort of position that you could possibility talk about for a map is > the ordinal order that an iterator returns key/element pairs. It is the reverse. Iterators is secondary to the order. Iterator walks pairs in the order of pairs = in the order their positions. > But that > necessarily changes when you insert/delete a pair, as that pair will occur > at some (unspecified) point in the ordinal order. Otherwise, you won't have > the performance expected for key lookup in a map. If you provide a random order, then yes. This is what an "insane" implementation would do. A "sane" implementation would deploy orders with reasonable properties. E.g. an obvious: k1/=k2/=k3 then (k1,v1) < (k2,v2) is preserved when (k3,v3) is added or removed. >> The problem is not whether you allocate pairs individually or not. The >> insanity begins with things unrelated to the map: >> >> 1. OOP iterator object. >> >> 2. FP iteration function. >> >> Both are bad ideas imposed by poor programming paradigms on implementation >> of a clear mathematical concept. That comes with constraints, assumptions >> and limitation array interface do not have. > > ??? Abstractions are "poor ideas"? Neither is an abstraction [as they are not entities of the problem space, but programming techniques artifacts, [anti-]patterns]. Iterator is an object of an unrelated type. Foreach is a stateful operation unrelated to the pure map interface. > You have some problem with an iterator > interface as opposed to an array interface?? Yes, I am against pointers (referential semantics) in general. BTW, Ada should have abstract pointer interface allowing the programmer to implement iterators = fat pointers. [ It would be fun with the pure unordered maps you suggested, the implementation of the pointer (iterator) would keep an array or an ordered set of keys... (:-)) ] >> for Index in reverse Map'Range loop >> Map.Delete (Index); >> end loop; >> >> would always work. > > It only works if you think of Map'Range as an iterator object. Otherwise, > you would have to impose an extra "position" interface on the map (or other > container), and at a substantial additional cost in time/space. Containers > in general don't have "positions", elements are unordered unless the > container imposes one. Yes, I would impose positions in all general case containers. Specialized very large containers where an implementation without cashing would become O(log n) rather than O(1) deploy other means of traversal anyway. >> Arrays have interface and implementation. The array interface is a mapping >> key -> value, the most fundamental thing in programming. > > That's only part of it. It also includes the idea of "position", Yes. Position in array is a mapping key/index <-> Natural. > including calculated positions, Yes. Natural numbers have numeric operations. > the operations of concatenation and slicing, That depends, but like with maps, it is expected. Maps as containers are expected to provide "concatenations" of pairs (set-theoretic union) and slicing (submaps). Because mathematically maps are sets of pairs and sets can be manipulated in many ways. Ordering does not add much to the interface. > and (for > Ada at least) ordering operations. If the array interface was *only* a > mapping I would not object to it. Maps do not have a natural order, and > nothing should be depending on such order. There is no meaning to the third > pair in a map. Yes, but those are not iteratable. We are talking about maps one can iterate. That requires an order. The question is only about the forms of exposure of that order in the interface. My objection is that iterators and foreach are poor forms. >> An array implementation as a contiguous block of values indexed by a >> linear function is a basic data structure that supports the interface. > > Right: the much more complex interface I note above. And that's the problem. > You don't even seem to realize all of the unnecessary baggage that arrays > carry with them. I don't see anything that is not already there. What are reasons for not providing: M (n) [ e.g. M (n).Key, M (n).Value ] M (n1..n2) [ in mutable contexts too ] M'First M'Last M1 & M2 [ M1 or M2 ] They are all well-defined and useful operations. > The problem with arrays is that the mapping part is tied to many other > supposedly fundamental capabilities that aren't fundamental at all. I disagree in the case of 1D arrays. There is of course interesting issues with nD arrays but that is where multiple inheritance kicks in, because in mathematics you can have "continuations" of concepts in more than one direction. So 1D array might be both an nD array and something else too. > Even > intellegent people such as yourself have been using arrays so long and so > primitively that you've gotten blinded to the fact that basic data > structures really have only a handful of operations, and the majority of the > "fundamental" capabilities aren't needed much of the time and certainly > should only be provided when needed. That is true. But again, it is solved by inheritance already. You can have an unordered map interface separately inherited by a general-case map. You can split interfaces to refine what operations they include from the implementation constraints point of view. So you can have a very flexible mesh of implementations sharing some interfaces, but not others. The best example is, of course, various types strings. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message news:umm4r5$ppag$1@dont-email.me... > On 2023-12-29 04:20, Randy Brukardt wrote: >> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message >> news:umk6ds$e9hc$1@dont-email.me... >> ... >>> Provided a sane implementation of map. >>> >>> 1. It is safe to loop over the map items in the *reverse* order of, >>> deleting whatever items. >> >> A sane implementation of a map does not have/require an ordering of keys. > > Yes, but iterating a map requires ordering regardless properties of the > keys. Only as far as there is an order implied by the order that things are returned. That order doesn't have any meaning, and certainly there isn't any such thing as "forward" or "reverse" to it. (Which was the original claim, after all.) There is no "natural" order to the key/element pairs; they are effectively unordered. ... >> So >> the idea of "reverse" or "forward" does not make sense for a general map. >> (There are, of course, special cases where the keys have an order that >> matters to the map; the standard ordered map is like that.) Assuming an >> ordering is exposing the implementation unnecessarily. > > It always does sense *IF* enumeration (needed for iteration) is provided. > Enumeration of pairs (<key>, <value>) is not same as ordering values by > the keys. True, but it doesn't imply any particular ordering. Certainly, no concept of "forward" or "reverse" applies to such an ordering (nor any stability requirement). Practically, you'll get the same order each time if the container isn't modified, but if it is, all bets are off. (If the container is changed by element addition or deletion, the index may get rebuilt [hash table reconstructed if too full, tree-index rebalanced, etc.] and that can change the iteration order dramatically.) ... > No. First, it is two different interfaces. A view of a map as: > > 1. An ordered set of pairs (<key>, <value>) This is not a map (in general). There is an *unordered* set of pairs. You can retrieve them all, but the order that is done is meaningless and is an artifact of the implementation. There's a reason that maps don't have reverse iterators. > 2. A mapping <key> -> <value> > > Second, the point is that both are array interfaces. The first has > position as the index, the second has the key as the index. "Position" is not a property of an (abstract) map. That's my complaint about looking at everything as an array -- one starts thinking in terms of properties that things don't have (or need). > Both are invariant to removal a pair and any *sane* implementation must be > OK with that. The only sort of position that you could possibility talk about for a map is the ordinal order that an iterator returns key/element pairs. But that necessarily changes when you insert/delete a pair, as that pair will occur at some (unspecified) point in the ordinal order. Otherwise, you won't have the performance expected for key lookup in a map. > The problem is not whether you allocate pairs individually or not. The > insanity begins with things unrelated to the map: > > 1. OOP iterator object. > > 2. FP iteration function. > > Both are bad ideas imposed by poor programming paradigms on implementation > of a clear mathematical concept. That comes with constraints, assumptions > and limitation array interface do not have. ??? Abstractions are "poor ideas"? You have some problem with an iterator interface as opposed to an array interface?? That make no sense at all given your other positions. > for Index in reverse Map'Range loop > Map.Delete (Index); > end loop; > > would always work. It only works if you think of Map'Range as an iterator object. Otherwise, you would have to impose an extra "position" interface on the map (or other container), and at a substantial additional cost in time/space. Containers in general don't have "positions", elements are unordered unless the container imposes one. ... > Arrays have interface and implementation. The array interface is a mapping > key -> value, the most fundamental thing in programming. That's only part of it. It also includes the idea of "position", including calculated positions, the operations of concatenation and slicing, and (for Ada at least) ordering operations. If the array interface was *only* a mapping I would not object to it. Maps do not have a natural order, and nothing should be depending on such order. There is no meaning to the third pair in a map. > An array implementation as a contiguous block of values indexed by a > linear function is a basic data structure that supports the interface. Right: the much more complex interface I note above. And that's the problem. You don't even seem to realize all of the unnecessary baggage that arrays carry with them. ... > Sure. The problem with Ada is that it does not separate array interface > from its built-in array implementation and does not separate record > interface and implementation either. Not arguing this. (Other than this is way down the list of problems with Ada, there are many that are worse.) ... > Now, tell me that you have a longstanding objection to the entire concept > of records... (:-)) Nope. There has to be a hetrogenous grouping of values, and records do it as well as anything else. I do agree that more abstraction would be nice. The problem with arrays is that the mapping part is tied to many other supposedly fundamental capabilities that aren't fundamental at all. Even intellegent people such as yourself have been using arrays so long and so primitively that you've gotten blinded to the fact that basic data structures really have only a handful of operations, and the majority of the "fundamental" capabilities aren't needed much of the time and certainly should only be provided when needed. Randy.
"DrPi" <314@drpi.fr> wrote in message
news:ummj1i$e64$1@rasp.pasdenom.info...
... (Example eliminated)
> That's what I did but I saved the keys (String) instead of the cursors.
> Does it make a difference ? Performance maybe ?
It certainly will make a performance difference; whether that difference is
significant of course depends on the implementation. There's two parts to it
(one of which I thought of yesterday and the other which I forgot):
(1) The cost of storing keys vs. storing cursors. Cursors are going to be
implemented as small record types (cannonically, they are two pointers, one
to the enclosing container and one to the specific node/element). A key can
be most anything, and storing that can be more costly.
(2) The cost of looking up a key. A map is a set of nodes, and there
needs to be some operation to associate a key with the correct node. Those
operations take some time, of course: for a hashed map, the key has to be
hashed and then some sort of lookup performed. Whereas a cursor generally
contains an indication of the node, so the access is more direct.
For a lot of applications, this difference won't matter enough to be
significant. But I'd probably lean toward using cursors for this sort of job
as that would minimize performance problems down the line. (Of course, if
the container gets modified after you save the cursors, then they could
become dangling, which is a problem of it's own. If that's a possibility,
saving the keys is better.)
Randy.
On 29/12/23 13:51, Randy Brukardt wrote:
> Thanks. I note this demostrates why one must compile their code before
> posting it here...
>
> *SYNTAX ERROR* Closing parenthesises missing.
>
*Sigh* ,,, also demonstrates the perils of posting after a long days
socializing.
On 2023-12-29 16:03, G.B. wrote: > On 29.12.23 10:51, Dmitry A. Kazakov wrote: >> On 2023-12-29 04:20, Randy Brukardt wrote: >>> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message >>> news:umk6ds$e9hc$1@dont-email.me... >>> ... >>>> Provided a sane implementation of map. >>>> >>>> 1. It is safe to loop over the map items in the *reverse* order of, >>>> deleting whatever items. >>> >>> A sane implementation of a map does not have/require an ordering of >>> keys. >> >> Yes, but iterating a map requires ordering regardless properties of >> the keys. > > Suppose that there is a way of orderly proceeding from one item to the > next. > It is probably known to the implementation of map. Do single steps > guarantee transitivity, though, so that an algorithm can assume the > order to be invariable? An insane implementation can expose random orders each time. > At the start of the algorithm, the assumption of order of items implies > an ordered sequence of all the keys. You do not need ordered keys to enumerate pairs. For example, consider a 2D array. As a map it has keys (row, column) which are unordered. > Someone might want to use this known > order for a cache of "index values". It might be the implementation > that does so. If not exposed through an interface the order cannot be known. The question is whether there must be such interface or not. In my view a good container library must provide position->pair interface, no OOP's cursors/iterators and no functional stuff like Foreach. > Insane? Or just tampering? (Randy Brukardt's example demonstrates > the mitigation using Cursor, I think.) Unless removing element invalidates all cursors. Look, insanity has no bounds. Cursors AKA pointers are as volatile as positions in certain implementations. Consider a garbage collector running after removing a pair and shuffling remaining pairs in memory. > Maybe the bulk operations of some DBMS' programming > interfaces work just like this, for practical reasons. > Ada 202x' Ordered_Maps might want to add a feature ;-) > > procedure Delete (Container : in out Map; > From : in out Cursor; > To : in out Cursor); Here you assume that cursors are ordered and the order is preserved from call to call. Even if From and To are stable the range From..To can include random pairs in between. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
On 29.12.23 10:51, Dmitry A. Kazakov wrote:
> On 2023-12-29 04:20, Randy Brukardt wrote:
>> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message
>> news:umk6ds$e9hc$1@dont-email.me...
>> ...
>>> Provided a sane implementation of map.
>>>
>>> 1. It is safe to loop over the map items in the *reverse* order of,
>>> deleting whatever items.
>>
>> A sane implementation of a map does not have/require an ordering of keys.
>
> Yes, but iterating a map requires ordering regardless properties of the keys.
Suppose that there is a way of orderly proceeding from one item to the next.
It is probably known to the implementation of map. Do single steps
guarantee transitivity, though, so that an algorithm can assume the
order to be invariable?
At the start of the algorithm, the assumption of order of items implies
an ordered sequence of all the keys. Someone might want to use this known
order for a cache of "index values". It might be the implementation
that does so.
Now some item is removed. The cache is no longer valid...
Insane? Or just tampering? (Randy Brukardt's example demonstrates
the mitigation using Cursor, I think.)
Maybe the bulk operations of some DBMS' programming
interfaces work just like this, for practical reasons.
Ada 202x' Ordered_Maps might want to add a feature ;-)
procedure Delete (Container : in out Map;
From : in out Cursor;
To : in out Cursor);
Le 29/12/2023 à 04:08, Randy Brukardt a écrit : > "DrPi" <314@drpi.fr> wrote in message > news:umjuvc$9sp$2@rasp.pasdenom.info... >> Le 28/12/2023 à 14:53, DrPi a écrit : >>> Iterate the Map and temporarily store the key nodes to be deleted then >>> delete the nodes from the key list ? >> >> Not clear. Rephrasing it. >> Using 2 steps by iterating the Map and temporarily store the keys of nodes >> to be deleted then delete the Map nodes using the key list ? > > If the keys are messy to save (as say with type String), it might be easier > to save the cursor(s) of the nodes to delete. You would probably want to use > a cursor iterator (that is, "in") to get the cursors. Code would be > something like (declarations of the Map and List not shown, nor is the > function Need_to_Delete which is obviously application specific, Save_List > is a list of cursors for My_Map, everything else is standard, not checked > for syntax errors): > > Save_List.Empty; -- Clear list of saved cursors. > -- Find the nodes of My_Map that we don't need. > for C in My_Map.Iterate loop > if Need_to_Delete (My_Map.Element(C)) then > Save_List.Append (C); > -- else no need to do anything. > end if; > end loop; > -- Delete the cursors of the nodes we don't want anymore. > for C of Save_List loop > My_Map.Delete(C); > end loop; > > That's what I did but I saved the keys (String) instead of the cursors. Does it make a difference ? Performance maybe ? Nicolas > > Randy. > >
On 2023-12-29 04:20, Randy Brukardt wrote: > "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message > news:umk6ds$e9hc$1@dont-email.me... > ... >> Provided a sane implementation of map. >> >> 1. It is safe to loop over the map items in the *reverse* order of, >> deleting whatever items. > > A sane implementation of a map does not have/require an ordering of keys. Yes, but iterating a map requires ordering regardless properties of the keys. > So > the idea of "reverse" or "forward" does not make sense for a general map. > (There are, of course, special cases where the keys have an order that > matters to the map; the standard ordered map is like that.) Assuming an > ordering is exposing the implementation unnecessarily. It always does sense *IF* enumeration (needed for iteration) is provided. Enumeration of pairs (<key>, <value>) is not same as ordering values by the keys. > You always complain about mixing implementation with interface, but you are > clearly doing that here. That technique really only works if the data > structure is implemented with an underlying array. If you have separately > allocated nodes, deletion might completely destroy a node that the iterator > is holding onto. Avoiding that takes significant efforts that sap > performance when you don't intend to modify the container you're iterating > (which is the usual case). No. First, it is two different interfaces. A view of a map as: 1. An ordered set of pairs (<key>, <value>) 2. A mapping <key> -> <value> Second, the point is that both are array interfaces. The first has position as the index, the second has the key as the index. Both are invariant to removal a pair and any *sane* implementation must be OK with that. The problem is not whether you allocate pairs individually or not. The insanity begins with things unrelated to the map: 1. OOP iterator object. 2. FP iteration function. Both are bad ideas imposed by poor programming paradigms on implementation of a clear mathematical concept. That comes with constraints, assumptions and limitation array interface do not have. for Index in reverse Map'Range loop Map.Delete (Index); end loop; would always work. OOP/FP anti-patterns, who knows? > My longstanding objection to the entire concept of arrays is that they are > not a data structure, but rather a building block for making data > structures. Arrays have interface and implementation. The array interface is a mapping key -> value, the most fundamental thing in programming. An array implementation as a contiguous block of values indexed by a linear function is a basic data structure that supports the interface. > One wants indexed sequences sometimes, cheap maps othertimes, > but arrays have all of the operations needed for both, along with other > capabilities not really related to data structures at all. Let me help (:-)) One wants array interface without a built-in array implementation. > It's way better > to declare what you need and get no more (visibly, at least). That makes it > way easier to swap implementations if that becomes necessary - you're not > stuck with a large array that really should be managed piecemeal. Sure. The problem with Ada is that it does not separate array interface from its built-in array implementation and does not separate record interface and implementation either. Both are mappings. BTW in many cases people could prefer record interface of a map to array interface: Map.Key instead of Map (Key) Now, tell me that you have a longstanding objection to the entire concept of records... (:-)) -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message
news:umk6ds$e9hc$1@dont-email.me...
...
> Provided a sane implementation of map.
>
> 1. It is safe to loop over the map items in the *reverse* order of,
> deleting whatever items.
A sane implementation of a map does not have/require an ordering of keys. So
the idea of "reverse" or "forward" does not make sense for a general map.
(There are, of course, special cases where the keys have an order that
matters to the map; the standard ordered map is like that.) Assuming an
ordering is exposing the implementation unnecessarily.
You always complain about mixing implementation with interface, but you are
clearly doing that here. That technique really only works if the data
structure is implemented with an underlying array. If you have separately
allocated nodes, deletion might completely destroy a node that the iterator
is holding onto. Avoiding that takes significant efforts that sap
performance when you don't intend to modify the container you're iterating
(which is the usual case).
My longstanding objection to the entire concept of arrays is that they are
not a data structure, but rather a building block for making data
structures. One wants indexed sequences sometimes, cheap maps othertimes,
but arrays have all of the operations needed for both, along with other
capabilities not really related to data structures at all. It's way better
to declare what you need and get no more (visibly, at least). That makes it
way easier to swap implementations if that becomes necessary - you're not
stuck with a large array that really should be managed piecemeal.
Randy.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain, Size: 1354 bytes --] "DrPi" <314@drpi.fr> wrote in message news:umjuvc$9sp$2@rasp.pasdenom.info... > Le 28/12/2023 à 14:53, DrPi a écrit : >> Iterate the Map and temporarily store the key nodes to be deleted then >> delete the nodes from the key list ? > > Not clear. Rephrasing it. > Using 2 steps by iterating the Map and temporarily store the keys of nodes > to be deleted then delete the Map nodes using the key list ? If the keys are messy to save (as say with type String), it might be easier to save the cursor(s) of the nodes to delete. You would probably want to use a cursor iterator (that is, "in") to get the cursors. Code would be something like (declarations of the Map and List not shown, nor is the function Need_to_Delete which is obviously application specific, Save_List is a list of cursors for My_Map, everything else is standard, not checked for syntax errors): Save_List.Empty; -- Clear list of saved cursors. -- Find the nodes of My_Map that we don't need. for C in My_Map.Iterate loop if Need_to_Delete (My_Map.Element(C)) then Save_List.Append (C); -- else no need to do anything. end if; end loop; -- Delete the cursors of the nodes we don't want anymore. for C of Save_List loop My_Map.Delete(C); end loop; Randy.
Thanks. I note this demostrates why one must compile their code before posting it here... Randy. P.S. And a Happy New Year to all! "Rod Kay" <rodakay5@gmail.com> wrote in message news:um9fan$2jjq3$1@dont-email.me... > for Each of Forum.Newsgroup ("comp.lang.ada").Members > loop > put_Line ("Merry Xmas, " & Each.Name & "."; ---------------------------------------------------^ *SYNTAX ERROR* Closing parenthesises missing. > end loop;
Le 28/12/2023 à 17:06, Dmitry A. Kazakov a écrit : > On 2023-12-28 14:59, DrPi wrote: >> Le 28/12/2023 à 14:53, DrPi a écrit : >>> Iterate the Map and temporarily store the key nodes to be deleted >>> then delete the nodes from the key list ? >> >> Not clear. Rephrasing it. >> Using 2 steps by iterating the Map and temporarily store the keys of >> nodes to be deleted then delete the Map nodes using the key list ? > > [Disclaimer. I am not talking about the standard library] I'm using the standard library ;) > > Provided a sane implementation of map. > > 1. It is safe to loop over the map items in the *reverse* order of, > deleting whatever items. > > 2. It is safe to walk whatever set of map keys, deleting items of the map. > > In both cases #1 positions, #2 keys are invariant to the operation of > deletion. >
On 2023-12-28 14:59, DrPi wrote: > Le 28/12/2023 à 14:53, DrPi a écrit : >> Iterate the Map and temporarily store the key nodes to be deleted then >> delete the nodes from the key list ? > > Not clear. Rephrasing it. > Using 2 steps by iterating the Map and temporarily store the keys of > nodes to be deleted then delete the Map nodes using the key list ? [Disclaimer. I am not talking about the standard library] Provided a sane implementation of map. 1. It is safe to loop over the map items in the *reverse* order of, deleting whatever items. 2. It is safe to walk whatever set of map keys, deleting items of the map. In both cases #1 positions, #2 keys are invariant to the operation of deletion. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
Le 28/12/2023 à 14:53, DrPi a écrit :
> Iterate the Map and temporarily store the key nodes to be deleted then
> delete the nodes from the key list ?
Not clear. Rephrasing it.
Using 2 steps by iterating the Map and temporarily store the keys of
nodes to be deleted then delete the Map nodes using the key list ?
Hi, I need to delete nodes from a Hashed_Map. I don't know which nodes to delete in advance. I have to iterate on the Map keys and delete the nodes which fulfill a condition. From the LRM I understand I can't delete nodes within a loop iterating the Map nodes. That makes sense. What's the recommended way of doing this ? Iterate the Map and temporarily store the key nodes to be deleted then delete the nodes from the key list ? Nicolas
> Eternal September is fine, but I find Thunderbird unusable. Since the
> latest batch of spam, I have to close it and open again to read anything
> - multiple times
I've been using TB and eternal-septembre for years (as have many others
here) with no worries and (almost) no spam. So this is strange. I hope
you find out what's wrong.
--
Stéphane Rivière
Ile d'Oléron - France
> While this might look negative at first sight, it will most probably
> reduce the amount of spam in newsgroups tremendously, as the bulk
> is currently posted via Google Groups.
I deeply agree. GG was a nuisance. For the sake of email, I hope they
drop too gmail one day ;> (I know I'm dreaming)
--
Stéphane Rivière
Ile d'Oléron - France
On Wednesday 12 December 2018 at 14:04:15 UTC, Olivier Henley wrote:
> Hi to all,
>
> Anyone knows of an initiative at providing a Neo4j() Ada client? Or any other graph db really...
>
> As most of you probably know, graph db are best to represent many-to-many relationships, eg. twitter social mapping (follow-followed) is probably using such representation.
>
> Neo4j (https://en.wikipedia.org/wiki/Neo4j)
> -client communicates through their Bolt protocol, which seems pretty straightforward (https://boltprotocol.org/v1/)
>
> Another one of interest is Dgraph (https://docs.dgraph.io/)
> -client communicate either through grpc(which requires protocol buffers) or REST endpoint
>
> Someone unrolled its own Ada one..?
>
> Anyway, I'm asking as raising awareness.
>
> Thx!
@Marius
Great! Thanks! Could use this along with other libraries in my Ada teaching classes.
Also use your slides along with Noe4j handbook for extension
God blesses!!!
Regards
for Each of Forum.Newsgroup ("comp.lang.ada").Members loop put_Line ("Merry Xmas, " & Each.Name & "."; end loop;
Season's greetings from the organizers of the 28th Ada-Europe International Conference on Reliable Software Technologies (AEiC 2024), to be held 11-14 June 2024, in Barcelona, Spain! Accepted Journal Track papers will be published in the conference's Special Issue of the Journal of Systems Architecture (JSA). Note that the Ada-Europe organization will waive the Open Access fees for the first four accepted papers, which do not already enjoy OA from other agreements with the Publisher. www.ada-europe.org/conference2024/cfp.html#cfpjournal (V3.1)
>Since Ada is mainly used in this area, why has Rust, which is much
>younger language, and target this same area has gained so much
>popularity but not Ada?
>
Adas ranged type system coupled with it's excellent record overlays make Ada
a much better choice than Rust. For safe and easy hardware register and
network protocols.
I can't imagine that ownership for data structures on a single runtime is
the reason (before SPARK got support).
A lot of Ada code will not run on any runtime but Rust also has nostd for
embedded use.
They often say Rust has excellent C interfacing support but Adas appears to
be even better.
Perhaps it is ease of use and guide availability which has improved or
simply perception and a lack of knowledge about Ada.
Rather than language merits. A lot of people only care about job
availabilty, money and library availability today but might consider a risk
if they perceive a future demand increase.
As to why the likes of Google and Microsoft are putting money behind it when
Ada would have been a better investment. You would have to ask them. Tell
me why Google continues to write security sensitive code like matter in
C++? When it could be written in Ada or Rust with a C binding.
Even javascript engines like Mozillas spidermonkey still has so little Rust
code. Though Mozilla does have more financial concerns and it's competitors
are already trying to say their browsers are faster. Yet Googles websites
use umpteen domains slowing browsing down anyway.
--
Regards, Kc
The library is an extension of GtkAda dealing with the following issues: - Tasking support; - Custom models for tree view widget; - Custom cell renderers for tree view widget; - Multi-columned derived model; - Extension derived model (to add columns to an existing model); - Abstract caching model for directory-like data; - Tree view and list view widgets for navigational browsing of abstract caching models; - File system navigation widgets with wildcard filtering; - Resource styles; - Capturing resources of a widget; - Embeddable images; - Some missing subprograms and bug fixes; - Measurement unit selection widget and dialogs; - Improved hue-luminance-saturation color model; - Simplified image buttons and buttons customizable by style properties; - Controlled Ada types for GTK+ strong and weak references; - Simplified means to create lists of strings; - Spawning processes synchronously and asynchronously with pipes; - Capturing asynchronous process standard I/O by Ada tasks and by text buffers; - Source view widget support; - SVG images support. http://www.dmitry-kazakov.de/ada/gtkada_contributions.htm Changes (18 December 2023) to the version 3.31: - Get_CSS_Name and Set_CSS_Name were added to Gtk.Missed; - Gtk.Widget.Styles.CSS_Store changed to enumerate labels of Gtk_Notebook or its descendants; - Since Gtk broke its CSS rules and the widget class cannot be used in the CSS style anymore and because unset widget names are defaulted to the class name but have no effect on the style name, Gtk.Widget.Styles.CSS_Store was changed to report only the widget name if different from the class names. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
Blady <p.p11@orange.fr> wrote: >Another solution might be adding a specific keyword in the subject of >the post [...] For instance: "[comp.lang.ada] blah blah." As I mentioned on the Ada Forum [1] yesterday: ------- Note that recently Google Groups started announcing that on 15 February 2024 they will stop supporting Usenet newsgroups, ie posting from Google Groups will no longer be possible, nor reading new postings from Usenet, only searching "old" content will remain available. While this might look negative at first sight, it will most probably reduce the amount of spam in newsgroups tremendously, as the bulk is currently posted via Google Groups. ------- So with some luck, the spam influx should be reduced to a trickle in a few months. Dirk [1] https://forum.ada-lang.io/t/gateway-to-comp-lang-ada/59/5?u=dirkcraeynest
Le 07/12/2023 à 13:34, Luke A. Guest a écrit :
> On 07/12/2023 11:36, Jeffrey R.Carter wrote:
>> On 2023-12-07 12:21, ldries46 wrote:
>>> Lately I get a lot of SPAM only in this Newsgroup. I am reading this
>>> group via Mozilla Thunderbird. How can I block this SPAM about 300
>>> till 600 messages a day or must someone who (say someone who has more
>>> privileges do so) If not is there a better route to read this group
>>> and block the SPAM
>>
>> Yes, there is a lot of spam here. With Thunderbird, under Tools, is
>> Message Filters. You can create filters to mark most of it as read and
>> to ignore the thread. If you also set your View=>Threads to Threads
>> with Unread, then you won't see them.
>>
>
> These are the filters I have set up one one rule:
>
> for each of these terms, subject -> contains ->
>
> our ladies
> escort
> sex
> model girls
> stunning babe
> call girl
>
> and From -> contains -> angelchristinee07@gmail.com
>
> That seems to cover most.
Another solution might be adding a specific keyword in the subject of
the post as AdaCore does when you send a report:
"Make sure to include the "GNAT" keyword in the subject line, or your
mail will be automatically rejected."
For instance: "[comp.lang.ada] blah blah."
My 2 cents, Pascal.
On 15/12/2023 15:23, Simon Wright wrote: > moi <findlaybill@blueyonder.co.uk> writes: > >> The 17.2 update is accompanied by updated Command Line Tools, >> so, having made a copy of the current CLTs, I let it update. > > I think you mean 14.2! Yes indeed, confusing it with iOS! > > GCC 13/CLT 15.* still has issues with exceptions, eg this unresolved > issue: https://github.com/iains/gcc-13-branch/issues/10, and the > ld-classic dance fixes them as far as I can tell. I have no problem when dancing classically. > > I'm working with this fix: https://github.com/simonjwright/xcode_15_fix > which is included in my GCC 13.2.0 build: > https://github.com/simonjwright/distributing-gcc/releases/tag/gcc-13.2.0-aarch64 > ... >> >> Strangely, this is now the ONLY one out of dozens of regression tests >> that fails in this software configuration. >> Previously, they all failed at the link stage. > > Yes, the 15.1 betas fixed the linking problem. I've no idea why some > exceptions don't get caught/raise memory access errors. I do think that > the aarch64 GCC 14 has fixed the problem. Good to know. Thanks again, Simon. -- Bill F.
moi <findlaybill@blueyonder.co.uk> writes: > The 17.2 update is accompanied by updated Command Line Tools, > so, having made a copy of the current CLTs, I let it update. I think you mean 14.2! GCC 13/CLT 15.* still has issues with exceptions, eg this unresolved issue: https://github.com/iains/gcc-13-branch/issues/10, and the ld-classic dance fixes them as far as I can tell. I'm working with this fix: https://github.com/simonjwright/xcode_15_fix which is included in my GCC 13.2.0 build: https://github.com/simonjwright/distributing-gcc/releases/tag/gcc-13.2.0-aarch64 > I get: > > A. with ”-largs -Wl,-ld_classic” in the linker parameters: > > /Users/wf/KDF9/emulation/Testing: failure > raised PROGRAM_ERROR : Open failed to get RW access > > This is what should happen. > > B. recompiled and relinked without ”-largs -Wl,-ld_classic”: > > /Users/wf/KDF9/emulation/Testing: failure > raised CONSTRAINT_ERROR : erroneous memory access > > OOPS! > > Strangely, this is now the ONLY one out of dozens of regression tests > that fails in this software configuration. > Previously, they all failed at the link stage. Yes, the 15.1 betas fixed the linking problem. I've no idea why some exceptions don't get caught/raise memory access errors. I do think that the aarch64 GCC 14 has fixed the problem.
The 17.2 update is accompanied by updated Command Line Tools, so, having made a copy of the current CLTs, I let it update. With GNAT 13.2.0 on Intel macOS 17.2 this happens: /Users/wf/KDF9/emulation/Testing: chmod 444 ST0 On compiling and running the minimum test case: with Ada.Direct_IO; with Ada.IO_Exceptions; procedure failure is package my_IO is new Ada.Direct_IO(Integer); use my_IO; my_file : File_Type; begin Open(my_file, Inout_File, "ST0"); exception when Ada.IO_Exceptions.Use_Error => raise program_error with "Open failed to get RW access"; end failure; I get: A. with ”-largs -Wl,-ld_classic” in the linker parameters: /Users/wf/KDF9/emulation/Testing: failure raised PROGRAM_ERROR : Open failed to get RW access This is what should happen. B. recompiled and relinked without ”-largs -Wl,-ld_classic”: /Users/wf/KDF9/emulation/Testing: failure raised CONSTRAINT_ERROR : erroneous memory access OOPS! Strangely, this is now the ONLY one out of dozens of regression tests that fails in this software configuration. Previously, they all failed at the link stage. -- Bill F.
On 2023-12-13 10:10, Luke A. Guest wrote: > On 13/12/2023 08:27, Dmitry A. Kazakov wrote: >> Then of course Rust continues the worst practices tried by Ada and >> C++: templates/generics, macros. > > What's the alternative to generics? The question is what is the alternative to static/parametric polymorphism. The answer is dynamic polymorphism. 1. Dynamic polymorphism in Ada is as static as generics are. No run-time penalty unlikely to C++. 2. It covers cases generics do not, e.g. you can have class-wide run-time objects and proper class-wide subprograms. 3. It supports modular programming en large. E.g. you can put a class member in a dynamically linked library. 4. It is fully testable. Generics are fundamentally non-testable, only concrete instances are. 5. It is does not create a meta language layer with complexities for the compiler and programmer. Advanced generic code is close to unmaintainable. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
On 13/12/2023 08:27, Dmitry A. Kazakov wrote: > What for? Any language comparisons lost their meaning long ago as the > whole language business degraded into hobbyist/corporate bullshit. True. >> Since Ada is mainly used in this area, why has Rust, which is much >> younger language, and target this same area has gained so much >> popularity but not Ada? I would say because they aimed to be a C++ replacement. > Because it is always someone's arbitrary decision. True. > Then of course Rust continues the worst practices tried by Ada and C++: > templates/generics, macros. What's the alternative to generics?
On 2023-12-13 05:28, Nasser M. Abbasi wrote: > Has anyone made study of difference between Rust and Ada for low level hardware > system software? You might be interested in this discussion: https://www.reddit.com/r/ada/comments/18c2nr4/where_is_ada_safer_than_rust/ -- Jeff Carter "I used to manufacture escalator shoes for people who were nauseous in elevator shoes." Take the Money and Run 142
On 2023-12-13 05:28, Nasser M. Abbasi wrote: > Has anyone made study of difference between Rust and Ada for low level > hardware > system software? What for? Any language comparisons lost their meaning long ago as the whole language business degraded into hobbyist/corporate bullshit. > Since Ada is mainly used in this area, why has Rust, which is much > younger language, and target this same area has gained so much > popularity but not Ada? Because it is always someone's arbitrary decision. > https://dl.acm.org/doi/fullHtml/10.1145/3551349.3559494 > > "Rust is a rising programming language designed to build system > software [4, 10, 20]. On the one hand, Rust offers access to and control > of the low-level system resources. On the other hand, > unlike conventional systems programming languages, Rust > ensures memory and concurrency safety" > > "Rust often inserts bound checks at the execution time to rule > out out-of-bound accesses" > > Well, does not Ada also "ensures memory and concurrency safety" > and checks for out-of-bound accesses? > > I am just wondering what does Rust brings to the table that > Ada does not have and why is Rust becoming so popular when > Ada is not. In my view Rust brings nothing and moreover is a huge step back comparing to Ada. Its main and only idea is to force the programmer to explicitly manage memory through references where Ada simply uses object notation regardless the mechanism doing same under the hood. Safety comes not through references but by limiting the number of cases you must resort to using dynamic allocation for statically scoped objects. E.g. Unbounded_String in Ada. As for my major concern - the type system and the abstraction mechanisms in general, there is nothing in Rust at all. Then of course Rust continues the worst practices tried by Ada and C++: templates/generics, macros. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
Has anyone made study of difference between Rust and Ada for low level hardware system software? Since Ada is mainly used in this area, why has Rust, which is much younger language, and target this same area has gained so much popularity but not Ada? https://dl.acm.org/doi/fullHtml/10.1145/3551349.3559494 "Rust is a rising programming language designed to build system software [4, 10, 20]. On the one hand, Rust offers access to and control of the low-level system resources. On the other hand, unlike conventional systems programming languages, Rust ensures memory and concurrency safety" "Rust often inserts bound checks at the execution time to rule out out-of-bound accesses" Well, does not Ada also "ensures memory and concurrency safety" and checks for out-of-bound accesses? I am just wondering what does Rust brings to the table that Ada does not have and why is Rust becoming so popular when Ada is not. I never used Rust myself, but used Ada. Any one done study comparing the two languages or knows both that can give some comments on this? --Nasser
Dirk Craeynest ezt írta (2023. április 1., szombat, 16:29:37 UTC+2):
> >>> Le 31/03/2023 à 19:45, Jeffrey R.Carter a écrit :
> >>>> You could try contacting Riehle directly.
>
> >> On 2023-04-01 12:34, DrPi wrote:
> >>> I would if I knew how to do it.
> >Le 01/04/2023 à 14:01, Jeffrey R.Carter a écrit :
> >> I have 2 e-mail addresses for him. I wouldn't want to post them
> >> publicly here. Is your posting address valid?
> In article <u097gm$j3i$1...@shakotay.alphanet.ch>, DrPi <3...@drpi.fr> wrote:
> >It is.
>
> Earlier today I was in contact with Richard. I mentioned your request,
> and gave him your e-mail address. Feel free to contact me, if Richard
> would not write to you shortly.
>
> HTH
>
> Dirk
I bought the book "Ada Distilled: ISO 2012 standard". Unfortunately, the editing of the version I received from Amazon is terrible, in many places the editing completely falls apart. (I don't have a Kindle reader, I use the PC version.)
Richard Riehle on LinkedIn wrote that if someone asks for an updated version of the book in pdf format, he will send it to them via private message.
Unfortunately, I cannot contact him on LinkedIn, so I would like to ask for his help.
Many thanks!
"J-P. Rosen" <rosen@adalog.fr> wrote in message
news:ul50lo$2p5cc$1@dont-email.me...
>...The so-called beaujolais effect was fixed in Ada95.
It's still something that is talked about today when new Ada features are
proposed; we don't want to reintroduce it, or the related "Ripple effect"
(which is associated with "with" clauses, and is named for a cheap American
wine brand circa 1980).
Randy.
Chris Townley <news@cct-net.co.uk> writes:
> I keep trying others to run under Windoze, but so far no good. Might
> try a Linux offering - I always have a few raspberry Pis hangins
> around, as well as a nice fast Ubuntu server
Emacs? I know many see it as a world of wierd ...
On 11/12/2023 22:05, Jeffrey R.Carter wrote:
> On 2023-12-11 14:04, Simon Wright wrote:
>> bill <bill.thomas.ghc@gmail.com> writes:
>>
>>> By the way, what happened
>>> to this site. So goes the world I guess.
>>
>> If you're using Google Groups: sex, betting, and pirate videos. And
>> disengagement by Google.
>>
>> If you're using a real news server (e.g eternal-september, aioe(?)) the
>> spam leakage is fairly minor.
>
> news.eternal-september.org, Thunderbird, and some simple filters, and
> it's practically nil.
>
Eternal September is fine, but I find Thunderbird unusable. Since the
latest batch of spam, I have to close it and open again to read anything
- multiple times
I keep trying others to run under Windoze, but so far no good. Might try
a Linux offering - I always have a few raspberry Pis hangins around, as
well as a nice fast Ubuntu server
--
Chris
On 2023-12-11 14:04, Simon Wright wrote:
> bill <bill.thomas.ghc@gmail.com> writes:
>
>> By the way, what happened
>> to this site. So goes the world I guess.
>
> If you're using Google Groups: sex, betting, and pirate videos. And
> disengagement by Google.
>
> If you're using a real news server (e.g eternal-september, aioe(?)) the
> spam leakage is fairly minor.
news.eternal-september.org, Thunderbird, and some simple filters, and it's
practically nil.
--
Jeff Carter
"What did concern with 'efficiency' ...
produce, besides a bigger, slower, and
more obscure program?"
Elements of Programming Style
199
bill <bill.thomas.ghc@gmail.com> writes:
> By the way, what happened
> to this site. So goes the world I guess.
If you're using Google Groups: sex, betting, and pirate videos. And
disengagement by Google.
If you're using a real news server (e.g eternal-september, aioe(?)) the
spam leakage is fairly minor.
On Sunday, December 10, 2023 at 8:06:24 AM UTC-5, Jeffrey R.Carter wrote:
> Happy birthday, Ada, born this day in 1815/1980.
>
> --
> Jeff Carter
> “C was designed to be written; Ada was designed to be read.”
> Jean Ichbiah
> 171
Nice to see someone remembered the old gal. By the way, what happened to this site. So goes the world I guess.
In article <ul50lo$2p5cc$1@dont-email.me>, J-P. Rosen <rosen@adalog.fr> wrote: >Sure. Ichbiah bet that the addition or removal of a use clause could >cause compilation errors, but could not give a working program with a >different meaning (a different resolution). [...] >The so-called beaujolais effect was fixed in Ada95. See also: https://en.wikipedia.org/wiki/Beaujolais_effect. And the reference given on that wiki-page: https://web.archive.org/web/20060823054957/http://www.adaic.com/learn/oldfaqs.html#beaujolais Dirk Dirk.Craeynest@cs.kuleuven.be (for Ada-Belgium/Ada-Europe/SIGAda/WG9) * 28th Ada-Europe Int. Conf. Reliable Software Technologies (AEiC 2024) * June 11-14, 2024, Barcelona, Spain, www.ada-europe.org/conference2024
Le 10/12/2023 à 00:34, jklsemicolon a écrit : > More than twenty years ago as high schooler digging into the stacks at a > community college library, I came across a book on Ada where a chapter epigraph > referenced a bug bounty where the finder of some variety of bug in the Ada > language specification would receive a case of wine. Does this ring any bells? > I realize that this is quite vague, but I didn't have the CS background then > to appreciate what I was reading, and events have taken me quite far from that > shelf on that day. > > ... We all live in a yellow subroutine... > Sure. Ichbiah bet that the addition or removal of a use clause could cause compilation errors, but could not give a working program with a different meaning (a different resolution). John Goodenough came up with such a case (a very contrived case, involving several levels of generics). I'm not sur that Ichbiah offered the bottle... The so-called beaujolais effect was fixed in Ada95. -- J-P. Rosen Adalog 2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX https://www.adalog.fr https://www.adacontrol.fr
Happy birthday, Ada, born this day in 1815/1980. -- Jeff Carter “C was designed to be written; Ada was designed to be read.” Jean Ichbiah 171
More than twenty years ago as high schooler digging into the stacks at a community college library, I came across a book on Ada where a chapter epigraph referenced a bug bounty where the finder of some variety of bug in the Ada language specification would receive a case of wine. Does this ring any bells? I realize that this is quite vague, but I didn't have the CS background then to appreciate what I was reading, and events have taken me quite far from that shelf on that day. ... We all live in a yellow subroutine...
\r>> Doh...Of course I can't wrap Line, ha ha. If I want the right line.
>
>Perhaps
>
>private with Gnat.Source_Info;
>
>package Source_Line_Info with SPARK_Mode is
> function Line ... with Global => null;
>private -- Source_Line_Info
> pragma SPARK_Mode (Off);
>
> function Line ... renames Gnat.Source_Info.line;
>end Source_Line_Info;
>
>(Untested)
Interesting, Thanks. I might just use random identifiers. With the added
benefit of knowing it will work with any runtime, any platform and any
compilation options.
--
Regards, Kc
On 2023-12-09 15:33, Kevin Chadwick wrote:
> On 09/12/2023 14:16, Kevin Chadwick wrote:
>>
>> I shall go with doing the above per package for Gnat.Source_Info.File and
>> wrapping the Gnat.Source_Info.Line procedure with one marked with Global =>
>> null.
>
> Doh...Of course I can't wrap Line, ha ha. If I want the right line.
Perhaps
private with Gnat.Source_Info;
package Source_Line_Info with SPARK_Mode is
function Line ... with Global => null;
private -- Source_Line_Info
pragma SPARK_Mode (Off);
function Line ... renames Gnat.Source_Info.line;
end Source_Line_Info;
(Untested)
--
Jeff Carter
"Unix and C are the ultimate computer viruses."
Richard Gabriel
99
On 09/12/2023 14:16, Kevin Chadwick wrote:
>>I can use the function File as a package global constant. Any other ideas?
>
>I shall go with doing the above per package for Gnat.Source_Info.File and
> wrapping the Gnat.Source_Info.Line procedure with one marked with Global =>
> null.
>
>Where would I suggest that Global => null be added to Line?
Doh...Of course I can't wrap Line, ha ha. If I want the right line.
--
Regards, Kc
>I can use the function File as a package global constant. Any other ideas?
I shall go with doing the above per package for Gnat.Source_Info.File and
wrapping the Gnat.Source_Info.Line procedure with one marked with Global =>
null.
Where would I suggest that Global => null be added to Line?
--
Regards, Kc
I guess the SPARK annotations in GNAT.Source_Info mark them as Volatile_Functions for good reason. I'm not sure how to handle using them in SPARK. They produce compile time known constants but I guess SPARK does not know e.g. the String length. I use them in a logging function which is everywhere. So I get error Volatile function call as actual is not allowed in SPARK when calling GNAT.Source_Info.Source_Location as a loggers parameter. Perhaps I should just avoid using them for SPARK compatibility? I can get by with GNAT.Source_Info.Line which only produces warnings and not the above error but it is not ideal. I can use the function File as a package global constant. Any other ideas? -- Regards, Kc
On 12/7/23 12:04, Pascal Obry wrote: > I had a account and read the doc there, all was configured as > advertised. I found the issue just after posting here, in GNOME > Evolution the NNTP posting does not work if you send NTTP message via > the outbox (that is, posting with a delay of 5 minutes). So a bug in > GNOME Evolution after all. I'm glad that you got it figured out. Email clients are decent, at best, news clients. ...as I type this in an email client. ;-) > Thanks for the quick reply. You're welcome. -- Grant. . . .
Hello Pascal,
>A side question, have you find a solution to post using news.eternal-
>september.org or is it read-only server? I can't send messages using
>GNOME Evolution NNTP support.
As you can see in the headers of my messages, they are posted via
eternal-september.org.
But I noticed in a later posting that you found the origin of your
problem is a bug in GNOME Evolution...
Dirk
Le jeudi 07 décembre 2023 à 11:45 -0600, Grant Taylor a écrit : > I believe that E-S requires authenticating to post. > > You should be able to ask for help configuring authentication in the > eternal-september.support newsgroup without authenticating. I had a account and read the doc there, all was configured as advertised. I found the issue just after posting here, in GNOME Evolution the NNTP posting does not work if you send NTTP message via the outbox (that is, posting with a delay of 5 minutes). So a bug in GNOME Evolution after all. Thanks for the quick reply. -- Pascal Obry / Magny Les Hameaux (78) The best way to travel is by means of imagination http://photos.obry.net gpg --keyserver keys.gnupg.net --recv-key F949BD3B
Le 07/12/2023 à 12:36, Jeffrey R.Carter a écrit :
> On 2023-12-07 12:21, ldries46 wrote:
>> Lately I get a lot of SPAM only in this Newsgroup. I am reading this
>> group via Mozilla Thunderbird. How can I block this SPAM about 300
>> till 600 messages a day or must someone who (say someone who has more
>> privileges do so) If not is there a better route to read this group
>> and block the SPAM
>
> Yes, there is a lot of spam here. With Thunderbird, under Tools, is
> Message Filters. You can create filters to mark most of it as read and
> to ignore the thread. If you also set your View=>Threads to Threads with
> Unread, then you won't see them.
>
I use a server which removes everything coming from google groups. No
more spam.
On 12/7/23 11:39, Pascal Obry wrote:
> A side question, have you find a solution to post using news.eternal-
> september.org or is it read-only server? I can't send messages using
> GNOME Evolution NNTP support.
I believe that E-S requires authenticating to post.
You should be able to ask for help configuring authentication in the
eternal-september.support newsgroup without authenticating.
--
Grant. . . .
Hi Dirk, > I usually read Usenet newsgroups via new.eternal-september.org and > only very seldomly see a spam message in the comp.lang.ada newsgroup. A side question, have you find a solution to post using news.eternal- september.org or is it read-only server? I can't send messages using GNOME Evolution NNTP support. Thanks, -- Pascal Obry / Magny Les Hameaux (78) The best way to travel is by means of imagination http://photos.obry.net gpg --keyserver keys.gnupg.net --recv-key F949BD3B
On 2023-12-07 17:51, Dirk Craeynest wrote: > For some time I have reported all of those as abuse. > When doing that Google claims: > > "Google takes abuse of its services very seriously. We're committed > to dealing with such abuse according to the laws in your country of > residence. When you submit a report, we'll investigate it and take > the appropriate action. We'll get back to you only if we require > additional details or have more information to share." Hmm, something whispers me that the spam is a product of these esteemed services... (:-)) -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
In article <nnd$5de7d841$38faa047@db6835260754ed96>,
ldries46 <bertus.dries@planet.nl> wrote:
>Lately I get a lot of SPAM only in this Newsgroup. I am reading this
>group via Mozilla Thunderbird. How can I block this SPAM about 300 till
>600 messages a day or must someone who (say someone who has more
>privileges do so) If not is there a better route to read this group and
>block the SPAM
I usually read Usenet newsgroups via new.eternal-september.org and
only very seldomly see a spam message in the comp.lang.ada newsgroup.
However, occasionally I check this newsgroup via Google Groups,
and there the last several weeks the amount of spam has increased
tremendously: indeed, several hundred a day!
For some time I have reported all of those as abuse.
When doing that Google claims:
"Google takes abuse of its services very seriously. We're committed
to dealing with such abuse according to the laws in your country of
residence. When you submit a report, we'll investigate it and take
the appropriate action. We'll get back to you only if we require
additional details or have more information to share."
But I haven't seen any impact, nor did I get any feedback.
So I guess only 2 ways remain to address this problem: either use a
newsreader that has sufficient "kill features" to junk most of those
spam messages, or switch to a newsserver that uses sophisticated
enough techniques to not distribute such spam in the first place.
HTH
Dirk
On 07/12/2023 11:36, Jeffrey R.Carter wrote:
> On 2023-12-07 12:21, ldries46 wrote:
>> Lately I get a lot of SPAM only in this Newsgroup. I am reading this
>> group via Mozilla Thunderbird. How can I block this SPAM about 300
>> till 600 messages a day or must someone who (say someone who has more
>> privileges do so) If not is there a better route to read this group
>> and block the SPAM
>
> Yes, there is a lot of spam here. With Thunderbird, under Tools, is
> Message Filters. You can create filters to mark most of it as read and
> to ignore the thread. If you also set your View=>Threads to Threads with
> Unread, then you won't see them.
>
These are the filters I have set up one one rule:
for each of these terms, subject -> contains ->
our ladies
escort
sex
model girls
stunning babe
call girl
and From -> contains -> angelchristinee07@gmail.com
That seems to cover most.
On 2023-12-07 12:21, ldries46 wrote:
> Lately I get a lot of SPAM only in this Newsgroup. I am reading this group via
> Mozilla Thunderbird. How can I block this SPAM about 300 till 600 messages a day
> or must someone who (say someone who has more privileges do so) If not is there
> a better route to read this group and block the SPAM
Yes, there is a lot of spam here. With Thunderbird, under Tools, is Message
Filters. You can create filters to mark most of it as read and to ignore the
thread. If you also set your View=>Threads to Threads with Unread, then you
won't see them.
--
Jeff Carter
"Now look, Col. Batguano, if that really is your name."
Dr. Strangelove
31
Lately I get a lot of SPAM only in this Newsgroup. I am reading this group via Mozilla Thunderbird. How can I block this SPAM about 300 till 600 messages a day or must someone who (say someone who has more privileges do so) If not is there a better route to read this group and block the SPAM
The PragmARCs are a library of (mostly) useful Ada reusable components provided as source code under the GMGPL or BSD 3-Clause license at https://github.com/jrcarter/PragmARC. This reminder will be posted about every six months so that newcomers become aware of the PragmARCs. I presume that those who want notification when the PragmARCs are updated have used Github's notification mechanism to receive them, so I no longer post update announcements. Anyone who wants to receive notifications without using Github's mechanism should contact me directly. -- Jeffrey R. Carter, President PragmAda Software Engineering github.com/jrcarter pragmada.x10hosting.com
On 2023-11-24 10:09, Ahlan Marriott wrote:
>
> subtype T is Long_Float;
>
> function Unbiased_Rounding (X : T) return T is
> Y : T;
> begin
> Asm (“vrintn.f64 %P0,%P1”,
> Outputs => T’asm_output (“=w”, Y),
> Inputs => T’asm_input (“w”, X));
> return Y;
> end Unbiased_Rounding;
What do you get from T'Unbiased_Rounding?
--
Jeff Carter
"In the frozen land of Nador they were forced to
eat Robin's minstrels, and there was much rejoicing."
Monty Python & the Holy Grail
70
On Sunday, November 19, 2023 at 1:22:22 PM UTC+1, Ahlan Marriott wrote:
> Hi,
> The following procedure Unbiased_Rounding for Float works as expected.
>
> function Unbiased_Rounding (X : Float) return Float is
> Y : Float;
> begin
> Asm ("vrintn.f32 %0,%1",
> Outputs => Float'asm_output ("=t", Y),
> Inputs => Float'asm_input ("t", X));
> return Y;
> end Unbiased_Rounding;
>
> according to https://gcc.gnu.org/onlinedocs/gcc/Machine-Constraints.html
> the constraint t means "VFP floating-point registers s0-s31. Used for 32 bit values” and the constraint w means "VFP floating-point registers d0-d31 and the appropriate subset d0-d15 based on command line options. Used for 64 bit values only”
>
> therefore we wrote our long_float version as
>
> function Unbiased_Rounding (X : Long_Float) return Long_Float is
> Y : Long_Float;
> begin
> Asm ("vrintn.f64 %0,%1",
> Outputs => Long_Float'asm_output ("=w", Y),
> Inputs => Long_Float'asm_input ("w", X));
> return Y;
> end Unbiased_Rounding;
>
> however this fails to compile.
> GNAT 11.2/0-4 (Alire) complains
> Error: invalid instruction shape -- `vrintn.f64 s14,s14’
>
> presumably because the operands are S registers rather than double precisions D registers.
> Is this a bug or have we misunderstood something?
>
> Best wishes,
> Ahlan
The solution is to use %P to access the parameters constrained using “w”
Try as I might I can’t find this wonderful secret documented anywhere.
I stumbled on the solution in the NXP forum where jingpan replied to a question on how to use the ARM VSQRT instruction for double.
When using the inline assembler from C and using named parameters you need to access parameters constrained by “w”, ie D registers using %P[name] rather than %[name] as everywhere else.
Using positional parameters one needs to use %Pn rather than %n
And yes it must be a capital P
I fail to understand why one needs to do this because surely the assembler already knows that the parameter has been constrained to a D register - but I guess this is just an additional quirk to an already very quirky assembler.
My GNAT Ada code to implement the Unbiased_Rounding attribute efficiently using the VFLOATN instruction is therefore
subtype T is Long_Float;
function Unbiased_Rounding (X : T) return T is
Y : T;
begin
Asm (“vrintn.f64 %P0,%P1”,
Outputs => T’asm_output (“=w”, Y),
Inputs => T’asm_input (“w”, X));
return Y;
end Unbiased_Rounding;
Of course we wouldn’t have to resort to assembler at all had there been a built-in intrinsic for VFLOATN as there is for all the other VFLOAT instructions. But I guess that is hoping for too much.
Best wishes and happy programming,
Ahlan
Hi, I noticed that SAAB is looking for software *engineers* with Ada knowledge to their Tampere office in Finland: https://www.saab.com/career/job-opportunities/sw-engineers I have no relation to them so please follow the job ad for more info. Yours, Tero
[-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain, Size: 16710 bytes --] ----------------------------------------------------------------------- UPDATED Call for Contributions 28th Ada-Europe International Conference on Reliable Software Technologies (AEiC 2024) 11-14 June 2024, Barcelona, Spain www.ada-europe.org/conference2024 *** Journal track submissions by 15 January 2024 *** *** Other submissions by 26 February 2024 *** Organized by Ada-Europe and Barcelona Supercomputing Center (BSC), in cooperation with ACM SIGAda, ACM SIGBED, ACM SIGPLAN, and Ada Resource Association (ARA) #AEiC2024 #AdaEurope #AdaProgramming ----------------------------------------------------------------------- *** General Information The 28th Ada-Europe International Conference on Reliable Software Technologies (AEiC 2024) will take place in Barcelona, Spain. AEiC is a leading international forum for providers, practitioners, and researchers in reliable software technologies. The conference presentations will illustrate current work in the theory and practice of the design, development, and maintenance of long-lived, high-quality software systems for a challenging variety of application domains. The program will also include keynotes, Q&A and discussion sessions, and social events. Participants include practitioners and researchers from industry, academia, and government organizations active in the development of reliable software technologies. The topics of interest for the conference include but are not limited to (more specific topics are described on the conference web page): * Formal and Model-Based Engineering of Critical Systems; * High-Integrity Systems and Reliability; * AI for High-Integrity Systems Engineering; * Real-Time Systems; * Ada Language; * Applications in Relevant Domains. The conference comprises different tracks and co-located events: * Journal track papers present research advances supported by solid theoretical foundation and thorough evaluation. * Industrial track contributions highlight industrial open challenges and/or the practitioners' side of a relevant case study or industrial project. * Work-in-progress track papers illustrate novel research ideas that are still at an initial stage, between conception and first prototype. * Tutorials guide attenders through a hands-on familiarization with innovative developments or with useful features related to reliable software. * Workshops provide discussion forums on themes related to the conference topics. * Vendor presentations and exhibitions allow for companies to showcase their latest products and services. *** Important Dates 15 January 2024 Deadline for submission of journal track papers 26 February 2024 Deadline for submission of industrial track papers, work-in-progress papers, tutorial and workshop proposals 22 March 2024 First round notification for journal track papers, and notification of acceptance for all other types of submissions 11-14 June 2024 Conference *** Call for Journal Track Submissions Following a journal-first model, this edition of the conference includes a journal track, which seeks original and high-quality papers that describe mature research work on the conference topics. Accepted journal track papers will be published in a Special Issue of Elsevier JSA - the Journal of Systems Architecture (Q1 ranked, CiteScore 8.5, impact factor 4.5). Accordingly, the conference is listed as "Journal Published" in the latest update of the CORE Conference Ranking released in August 2023. Contributions must be submitted by 15 January 2024. Submissions should be made online at https://www.editorialmanager.com/jsa/, selecting the "Ada-Europe AEiC 2024" option (submission page open from 15 November 2023) as article type of the paper. General information for submitting to the JSA can be found at the Journal of Systems Architecture website. JSA has adopted the Virtual Special Issue model to speed up the publication process, where Special Issue papers are published in regular issues, but marked as SI papers. Acceptance decisions are made on a rolling basis. Therefore, authors are encouraged to submit papers early, and need not wait until the submission deadline. Authors who have successfully passed the first round of review will be invited to present their work at the conference. The abstract of the accepted contributions will be included in the conference booklet. The Ada-Europe organization will waive the Open Access fees for the first four accepted papers (whose authors do not already enjoy Open Access agreements). Subsequent papers will follow JSA regular publishing track. Prospective authors may direct all enquiries regarding this track to the corresponding chairs, Bjorn Andersson (baandersson@sei.cmu.edu) and Luis Miguel Pinho (lmp@isep.ipp.pt). *** Call for Industrial Track Submissions The conference seeks industrial practitioner presentations that deliver insight on the challenges of developing reliable software. Especially welcome kinds of submissions are listed on the conference website. Given their applied nature, such contributions will be subject to a dedicated practitioner-peer review process. Interested authors shall submit a 1-to-2 pages abstract, by 26 February 2024, via EasyChair at https://easychair.org/my/conference?conf=aeic2024, selecting the "Industrial Track". The format for submission is strictly in PDF, following the Ada User Journal style. Templates are available at http://www.ada-europe.org/auj/guide. The abstract of the accepted contributions will be included in the conference booklet. The corresponding authors will get a presentation slot in the prime-time technical program of the conference and will also be invited to expand their contributions into full-fledged articles for publication in the Ada User Journal, which will form the proceedings of the industrial track of the Conference. Prospective authors may direct all enquiries regarding this track to its chairs Luciana Provenzano (luciana.provenzano@mdu.se) and Michael Pressler (Michael.Pressler@de.bosch.com). *** Call for Work-in-Progress Track Submissions The work-in-progress track seeks two kinds of submissions: (a) ongoing research and (b) early-stage ideas. Ongoing research submissions are 4-page papers describing research results that are not mature enough to be submitted to the journal track. Early-stage ideas are 1-page papers that pitch new research directions that fall within the scope of the conference. Both kinds of submissions must be original and shall undergo anonymous peer review. Submissions by recent MSc graduates and PhD students are especially sought. Authors shall submit their work by 26 February 2024, via EasyChair at https://easychair.org/my/conference?conf=aeic2024, selecting the "Work-in-Progress Track". The format for submission is strictly in PDF, following the Ada User Journal style. Templates are available at http://www.ada-europe.org/auj/guide. The abstract of the accepted contributions will be included in the conference booklet. The corresponding authors will get a presentation slot in the prime-time technical program of the conference and will also be offered the opportunity to expand their contributions into 4-page articles for publication in the Ada User Journal, which will form the proceedings of the WiP track of the Conference. Prospective authors may direct all enquiries regarding this track to the corresponding chairs Alejandro R. Mosteo (amosteo@unizar.es) and Ruben Martins (rubenm@andrew.cmu.edu). *** Awards The organization will offer an honorary award for the best technical presentation, to be announced in the closing session of the conference. *** Call for Tutorials The conference seeks tutorials in the form of educational seminars on themes falling within the conference scope, with an academic or practitioner slant, including hands-on or practical elements. Tutorial proposals shall include a title, an abstract, a description of the topic, an outline of the presentation, the proposed duration (half-day or full-day), the intended level of the contents (introductory, intermediate, or advanced), and a statement motivating attendance. Tutorial proposals shall be submitted at any time but no later than the 26 February 2024 to the respective chair Maria A. Serrano (maria.serrano@nearbycomputing.com), with subject line: "[AEiC 2024: tutorial proposal]". Once submitted, each tutorial proposal will be evaluated by the conference organizers as soon as possible, with decisions from January 1st. The authors of accepted full-day tutorials will receive a complimentary conference registration, halved for half-day tutorials. The Ada User Journal will offer space for the publication of summaries of the accepted tutorials. *** Call for Workshops The conference welcomes satellite workshops centred on themes that fall within the conference scope. Proposals may be submitted for half- or full-day events, to be scheduled at either end of the AEiC conference. Workshop organizers shall also commit to producing the proceedings of the event, for publication in the Ada User Journal. Workshop proposals shall be submitted at any time but no later than the 26 February 2024 to the respective chair Sergio Saez (ssaez@disca.upv.es), with subject line: "[AEiC 2024: workshop proposal]". Once submitted, each workshop proposal will be evaluated by the conference organizers as soon as possible, with decisions from January 1st. *** Academic Listing The Journal of Systems Architecture, publication venue of the journal track proceedings of the conference, is Q1 ranked, with CiteScore 8.5 and Impact Factor 4.5. The Ada User Journal, venue of all other technical proceedings of the conference, is indexed by Scopus and by EBSCOhost in the Academic Search Ultimate database. *** Call for Exhibitors and Sponsors The conference will include a vendor and technology exhibition with the option of a 20 minutes presentation as part of the conference program. Interested providers should direct inquiries to the Exhibition & Sponsorship Chair Ahlan Marriot (ahlan@ada-switzerland.ch). *** Venue The conference will take place in Barcelona, Spain. Barcelona is a major cultural, economic, and financial centre, known for its architecture, culture, and Mediterranean atmosphere, a hub for technology and innovation. There's plenty to see and visit in Barcelona, so plan in advance! *** Organizing Committee - Conference Chair Sara Royuela, Barcelona Supercomputing Center, Spain sara.royuela@bsc.es - Journal Track Chairs Bjorn Andersson, Carnegie Mellon University, USA baandersson@sei.cmu.edu Luis Miguel Pinho, ISEP & INESC TEC, Portugal lmp@isep.ipp.pt - Industrial Track Chairs Luciana Provenzano, Mälardalen University, Sweden luciana.provenzano@mdu.se Michael Pressler, Robert Bosch GmbH, Germany Michael.Pressler@de.bosch.com - Work-In-Progress Track Chairs Alejandro R. Mosteo, CUD Zaragoza, Spain amosteo@unizar.es Ruben Martins, Carnegie Mellon University, USA rubenm@andrew.cmu.edu - Tutorial Chair Maria A. Serrano, NearbyComputing, Spain maria.serrano@nearbycomputing.com - Workshop Chair Sergio Saez, Universitat Politècnica de València, Spain ssaez@disca.upv.es - Exhibition & Sponsorship Chair Ahlan Marriott, White Elephant GmbH, Switzerland ahlan@Ada-Switzerland.ch - Publicity Chair Dirk Craeynest, Ada-Belgium & KU Leuven, Belgium Dirk.Craeynest@cs.kuleuven.be - Webmaster Hai Nam Tran, University of Brest, France hai-nam.tran@univ-brest.fr - Local Chair Nuria Sirvent, Barcelona Supercomputing Center, Spain nuria.sirvent@bsc.es *** Program Committees See the conference website for the Program Committees for the Journal, Industrial, and Work-in-Progress tracks. *** Journal Track Committee Al Mok, University of Texas at Austin, USA Alejandro Mosteo, CUD Zaragoza, Spain Alwyn Godloe, NASA, USA António Casimiro, University of Lisbon, Portugal Barbara Gallina, Mälardalen University, Sweden Bernd Burgstaller, Yonsei University, South Korea C. Michael Holloway, NASA, USA Cristina Seceleanu, Mälardalen University, Sweden Doug Schmidt, Vanderbilt University, USA Frank Singhoff, University of Brest, FR George Lima, Universidade Federal da Bahia, Brazil Isaac Amundson, Rockwell Collins, USA Jérôme Hugues, CMU/SEI, USA José Cruz, Lockeed Martin, USA Kristoffer Nyborg Gregertsen, SINTEF Digital, Norway Laurent Pautet, Telecom ParisTech, France Leonidas Kosmidis, Barcelona Supercomputing Center, Spain Mario Aldea Rivas, University of Cantabria, Spain Matthias Becker, KTH - Royal Institute of Technology, Sweden Patricia López Martínez, University of Cantabria, Spain Sara Royuela, Barcelona Supercomputing Center, Spain Sergio Sáez, Universitat Politècnica de València, Spain Tucker Taft, AdaCore, USA Tullio Vardanega, University of Padua, Italy Xiaotian Dai, University of York, England *** Industrial Track Committee Aida Causevic, Alstom, Sweden Alexander Viehl, Research Center for Information Technology, Germany Ana Rodríguez, Silver Atena, Spain Aurora Agar, NATO, Netherlands Behnaz Pourmohseni, Robert Bosch GmbH, Germany Claire Dross, AdaCore, France Elena Lisova, Volvo CE, Sweden Enricco Mezzeti, Barcelona Supercomputing Center, Spain Federico Aromolo, Scuola Superiore Sant'Anna, Italy Helder Silva, Edisoft, Portugal Hugo Torres Vieira, Evidence Srl, Italy Irune Agirre, Ikerlan, Spain Jordi Cardona, Rapita Systems, Spain José Ruiz, AdaCore, France Joyce Tokar, Raytheon, USA Luciana Alvite, Alstom, Germany Marco Panunzio, Thales Alenia Space, France Patricia Balbastre Betoret, Valencia Polytechnic University, Spain Philippe Waroquiers, Eurocontrol NMD, Belgium Raúl de la Cruz, Collins Aerospace, Ireland Santiago Urueña, GMV, Spain Stef Van Vlierberghe, Eurocontrol NMD, Belgium *** Work-in-Progress Track Committee Alan Oliveira, University of Lisbon, Portugal J. Javier Gutiérrez, University of Cantabria, Spain Jérémie Guiochet, LAAS-CNRS, France Kalinka Branco, University of São Paulo, Brazil Katherine Kosaian, University of Iowa, USA Kevin Cheang, AWS, USA Kristin Yvonne Rozier, Iowa State University, USA Leandro Buss Becker, University of Manchester, UK Li-Pin Chang, National Yang Ming Chiao Tung University, Taiwan Mathias Preiner, Stanford University, USA Raffaele Romagnoli, Carnegie Mellon University, USA Robert Kaiser, RheinMain University of Applied Sciences, Germany Sara Abbaspour, Mälardalen University, Sweden Sergi Alcaide, Barcelona Supercomputing Center, Spain Simona Bernardi, Unizar, Spain Stefan Mitsch, School of Computing at DePaul University, USA Teresa Lázaro, Aragon's Institute of Technology, Spain Tiago Carvalho, ISEP, Portugal Yannick Moy, AdaCore, France *** Previous Editions Ada-Europe organizes annual international conferences since the early 80's. This is the 28th event in the Reliable Software Technologies series, previous ones being held at Montreux, Switzerland ('96), London, UK ('97), Uppsala, Sweden ('98), Santander, Spain ('99), Potsdam, Germany ('00), Leuven, Belgium ('01), Vienna, Austria ('02), Toulouse, France ('03), Palma de Mallorca, Spain ('04), York, UK ('05), Porto, Portugal ('06), Geneva, Switzerland ('07), Venice, Italy ('08), Brest, France ('09), Valencia, Spain ('10), Edinburgh, UK ('11), Stockholm, Sweden ('12), Berlin, Germany ('13), Paris, France ('14), Madrid, Spain ('15), Pisa, Italy ('16), Vienna, Austria ('17), Lisbon, Portugal ('18), Warsaw, Poland ('19), online from Santander, Spain ('21), Ghent, Belgium ('22), and Lisbon, Portugal ('23). Information on previous editions of the conference can be found at www.ada-europe.org/confs/ae. ----------------------------------------------------------------------- Our apologies if you receive multiple copies of this announcement. Please circulate widely. Dirk Craeynest, AEiC 2024 Publicity Chair Dirk.Craeynest@cs.kuleuven.be * 28th Ada-Europe Int. Conf. Reliable Software Technologies (AEiC 2024) * June 11-14, 2024, Barcelona, Spain, www.ada-europe.org/conference2024 (V2.1)
Hi, The following procedure Unbiased_Rounding for Float works as expected. function Unbiased_Rounding (X : Float) return Float is Y : Float; begin Asm ("vrintn.f32 %0,%1", Outputs => Float'asm_output ("=t", Y), Inputs => Float'asm_input ("t", X)); return Y; end Unbiased_Rounding; according to https://gcc.gnu.org/onlinedocs/gcc/Machine-Constraints.html the constraint t means "VFP floating-point registers s0-s31. Used for 32 bit values” and the constraint w means "VFP floating-point registers d0-d31 and the appropriate subset d0-d15 based on command line options. Used for 64 bit values only” therefore we wrote our long_float version as function Unbiased_Rounding (X : Long_Float) return Long_Float is Y : Long_Float; begin Asm ("vrintn.f64 %0,%1", Outputs => Long_Float'asm_output ("=w", Y), Inputs => Long_Float'asm_input ("w", X)); return Y; end Unbiased_Rounding; however this fails to compile. GNAT 11.2/0-4 (Alire) complains Error: invalid instruction shape -- `vrintn.f64 s14,s14’ presumably because the operands are S registers rather than double precisions D registers. Is this a bug or have we misunderstood something? Best wishes, Ahlan
moi <findlaybill@blueyonder.co.uk> writes:
> On 18/11/2023 14:22, Martin Krischik wrote:
>> moi schrieb am Freitag, 22. September 2023 um 22:02:21 UTC+2:
>>> Installing the macOS Ventura 13.6 security update clobbers GNAT.
>> Great. I already put off major macOS updated because I don't want to
>> break a working system. Now I need to avoid „security“ updates as
>> well. The „just works“ sale point is eroding.
>
> It was actually the well hidden update of the Command Line Tools
> accompanying th security update that caused the problem.
> Just make sure to unselect the CLT update.
>
>>> Simon's "magic formula", '-largs -Wl,-ld_classic' restores sanity.
>> Now I have to find out how that works.
>
> Just add "-largs -Wl,-ld_classic" to the linker parameters,
> if you have updated the CLTs.
e.g. gnatmake foo.adb -largs -Wl,-ld_classic
or gprbuild -P foo -largs -Wl,-ld_classic
or alr build -- -largs -Wl,-ld_classic
The GNAT tools use gcc to drive the system linker ld. When gcc sees
-Wl,-foo,bar it sends "-foo bar" to ld (the 'l' means 'linker'; see the
GCC switches web page for the other possibilities).
When /usr/bin/ld (from Xcode 15) sees -ld_classic, rather than taking it
as an instruction to process libld_classic.{a,dylib}, it delegates the
actual link to /Library/Developer/CommandLineTools/usr/bin/ld-classic.
Wow.
You could always download the 15.1 beta version of the tools package
from developer.apple.com
On 18/11/2023 14:22, Martin Krischik wrote: > moi schrieb am Freitag, 22. September 2023 um 22:02:21 UTC+2: >> Installing the macOS Ventura 13.6 security update clobbers GNAT. > > Great. I already put off major macOS updated because I don't want to break a working system. Now I need to avoid „security“ updates as well. The „just works“ sale point is eroding. It was actually the well hidden update of the Command Line Tools accompanying th security update that caused the problem. Just make sure to unselect the CLT update. >> Simon's "magic formula", '-largs -Wl,-ld_classic' restores sanity. > Now I have to find out how that works. Just add "-largs -Wl,-ld_classic" to the linker parameters, if you have updated the CLTs. -- Bill F.
moi schrieb am Freitag, 22. September 2023 um 22:02:21 UTC+2: > Installing the macOS Ventura 13.6 security update clobbers GNAT. Great. I already put off major macOS updated because I don't want to break a working system. Now I need to avoid „security“ updates as well. The „just works“ sale point is eroding. > Simon's "magic formula", '-largs -Wl,-ld_classic' restores sanity. Now I have to find out how that works. Martin
AdaMagica schrieb am Freitag, 17. November 2023 um 14:12:25 UTC+1: > Blady schrieb am Donnerstag, 16. November 2023 um 21:29:20 UTC+1: > > Thanks, yes, the instanciation of Unchecked_Deallocation seemed to > > indicate that but I was not able to confirm it from the Ada RM. > > A mention in Ada RM 13.11.2 Unchecked Storage Deallocation of that > > particular possibility would be valuable. > type Object(<>) is limited private; > > The box here denotes unknown discriminants, i.e. indefinite types - these include task types; nonsense - I mean class types > limited is "assume the worst" => i.e. any type may be used as actual type for this formal type.
Blady schrieb am Donnerstag, 16. November 2023 um 21:29:20 UTC+1:
> Thanks, yes, the instanciation of Unchecked_Deallocation seemed to
> indicate that but I was not able to confirm it from the Ada RM.
> A mention in Ada RM 13.11.2 Unchecked Storage Deallocation of that
> particular possibility would be valuable.
type Object(<>) is limited private;
The box here denotes unknown discriminants, i.e. indefinite types - these include task types;
limited is "assume the worst" => i.e. any type may be used as actual type for this formal type.
On Friday, November 17, 2023 at 3:30:38 AM UTC+1, Petter wrote:
> with "..\..\..\..\GNAT\2021\share\gpr\gnatcoll.gpr";
>
> Any Suggestions?
`<GNAT root>/2021/share/gpr` should already be in the default project file search path.
`with "gnatcoll";` should be enough (and will update to corresponding versions of gnatcoll when you update the compiler)
On 11/16/2023 8:30 PM, Petter wrote:
> with "..\..\..\..\GNAT\2021\share\gpr\gnatcoll.gpr";
Try to see if you escape the \ like this
with "..\\..\\..\\..\\GNAT\\2021\\share\\gpr\\gnatcoll.gpr";
or
with "../../../../GNAT/2021/share/gpr/gnatcoll.gpr";
and see if this fixes it
--Nasser
with "..\..\..\..\GNAT\2021\share\gpr\gnatcoll.gpr"; with "../Utilities/utilities.gpr"; project Ugroups is type Build_Kind is ("static", "relocatable", "static-pic"); for Object_Dir use "obj"; for Main use ("main.adb"); GPR_BUILD : Build_Kind := external ("GPR_BUILD"); package Compiler is for Switches ("ada") use ("-g"); end Compiler; package Linker is for Switches ("ada") use ("-g"); end Linker; package Ide is for Vcs_Kind use "git"; end Ide; case GPR_BUILD is when "static" => for Source_Dirs use ("src"); when "relocatable" => for Source_Dirs use ("src"); when "static-pic" => for Source_Dirs use ("src); end case; end Ugroups; When trying to build All Iget the following error: 2023-11-17 02:59:24] Could not locate executable on path: . [2023-11-17 02:59:24] process exited with status -1, elapsed time: 00.41s Any Suggestions?
torsdag 16 november 2023 kl. 22:45:55 UTC+1 skrev Simon Wright:
> Petter <petter_...@hotmail.com> writes:
>
> > Any suggestions?
>
> Something is probably wrong with your code.
> .
> .
> .
> .
> Perhaps if you posted a reproducible example we would be more likely to
> be able to help.
>
> https://stackoverflow.com/help/minimal-reproducible-example
redesigninhg know. Sorry to have bothered you.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain, Size: 3145 bytes --] On each of the individual Reference Manual pages (that is, Ada 2012, Ada 2022, etc.) on Ada-Auth.org, at the bottom, you will find links for the formatting tool, one for a Windows executable, one for the CVS, and one for a ZIP file containing the source. I'm not sure why you are seeing compilation problems with the CVS; it appears complete and correct on my end. Did you make sure that you have the latest versions of all of the files (they were updated on October 3rd)? For example, the ARM_Frm.Adb file should have a change entry of: -- 9/11/23 - RLB - Added Usage category and commands. and of course have code for the Usage category and commands. I've started some work for the post-Ada 2022 RM (currently known as Ada 202y) - the tool is constantly evolving. One of the advantages of using the ZIP files is that they reflect the tool as it was used to generate a specific version of the RM; the "current" version of the tool probably only has been tested on the "current" version of the RM source and thus it is not certain to work perfectly. Randy. "Vincent D." <vincent.diemunsch@gmail.com> wrote in message news:d90c3551-5483-46ba-8813-a30f8759d665n@googlegroups.com... Le mercredi 1 novembre 2023 à 02:56:27 UTC+1, Randy Brukardt a écrit : > > Because it's not in CVS. > It is now. And it always was in the ZIP file of the source. (That is made > from the files that I use to compile the tool, so it should always be > compilable.) > > One of the big downsides of working at home is that some support functions > get delayed until one gets into the office -- and that means that they're > easily forgotten. As in this case, checking the new files into the CVS > (the > existing files were updated, of course, leaving a mess for anyone trying > to > buold from the CVS). > > Sorry about that. > > Randy. I am sorry, but even if I put the package "arm_paragraph" in the source code, I get compile errors : for instance in version 0e95e9125e066ce564fe369221821452535b6260 : gprbuild -p -P ada_form.gpr Compile [Ada] arm_form.ada [Ada] arm_cont.adb [Ada] arm_frm.adb arm_frm.adb:1163:13: error: missing case value: "Usage" arm_frm.adb:1544:33: error: missing case value: "Usage" arm_frm.adb:1680:33: error: missing case value: "Usage" arm_frm.adb:1738:17: error: missing case value: "Usage" arm_frm.adb:2099:17: error: missing case value: "Usage" arm_frm.adb:2197:17: error: missing case value: "Usage" arm_frm.adb:9357:53: error: "Numbered_T_and_D_List" not declared in "ARM_Database" arm_frm.adb:9362:53: error: "T_and_D_List" not declared in "ARM_Database" arm_frms.adb:1415:33: error: unmatched actual "Note1_Text" in call gprbuild: *** compilation phase failed And with the latest : gprbuild -p -P ada_form.gpr Compile [Ada] arm_form.ada arm_form.ada:263:41: error: "Rest" not declared in "ARM_Master" gprbuild: *** compilation phase failed What is the ZIP file of the source that you mentioned ? Where can I find it ? Regards, Vincent.
Petter <petter_fryklund@hotmail.com> writes: > Any suggestions? Something is probably wrong with your code. . . . . Perhaps if you posted a reproducible example we would be more likely to be able to help. https://stackoverflow.com/help/minimal-reproducible-example
Circular dependency: Main (body) depends on commands(spec) commands(spec) depends on commands(spec) Any suggestions? Regards Petter
Le 15/11/2023 à 22:17, Dmitry A. Kazakov a écrit : > On 2023-11-15 21:26, Blady wrote: >> Le 14/11/2023 à 23:42, Dmitry A. Kazakov a écrit : >>>> But what does "Finalize (OB);"? <...> > Regarding Unchecked_Deallocation instantiated with a pointer to a > class-wide object, consider it dispatching on the target object tag. > Thus you can deallocate any object using any instance of > Unchecked_Deallocation for any class-wide parent of, interfaces included. > > So Finalize (OB) is OK. > Thanks, yes, the instanciation of Unchecked_Deallocation seemed to indicate that but I was not able to confirm it from the Ada RM. A mention in Ada RM 13.11.2 Unchecked Storage Deallocation of that particular possibility would be valuable. Regards, Pascal. PS: after a quick search, I found also a smart answer with a full example from Simon: https://stackoverflow.com/questions/64951954/how-can-i-do-an-unchecked-deallocation-of-abstract-classes-in-ada
On 2023-11-15 21:26, Blady wrote: > Le 14/11/2023 à 23:42, Dmitry A. Kazakov a écrit : >>> But what does "Finalize (OB);"? >> >> Crashes your program. It is a bug. You should instantiate >> Unchecked_Deallocation with class-wide type if you pass a class-wide >> pointer. > > Thanks, I haven't considered this possibility. > Note: the previous program built with GNAT FSF 13.2.0 ran without > exception. > > I've changed: > with Ada.Unchecked_Deallocation; > procedure test_20231113_free_class is > > type TTA is tagged record > AA : Integer; > end record; > type ATTA is access all TTA; > type CATTA is access all TTA'Class; > procedure Finalize (O : in out CATTA) is > procedure Free is new Ada.Unchecked_Deallocation (TTA'Class, CATTA); > begin > Free (O); > end Finalize; > > type TTB is new TTA with record > BB : Integer; > end record; > type ATTB is access all TTB; > type CATTB is access all TTB'Class; > procedure Finalize (O : in out CATTB) is > begin > Finalize (CATTA (O)); > end Finalize; > > OA : CATTA := new TTA; > OB : CATTB := new TTB; > > begin > Finalize (OA); > Finalize (OB); > end test_20231113_free_class; > > It runs without exception. > One question remains about "Finalize (OB);": > Which memory size is deallocated TTA'Size or TTB'Size? It is a wrong question. The implementation of the pool may ignore size using the block size instead. Furthermore T'Size is not necessarily the size actually allocated. Regarding Unchecked_Deallocation instantiated with a pointer to a class-wide object, consider it dispatching on the target object tag. Thus you can deallocate any object using any instance of Unchecked_Deallocation for any class-wide parent of, interfaces included. So Finalize (OB) is OK. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
Le 14/11/2023 à 23:42, Dmitry A. Kazakov a écrit :
>> But what does "Finalize (OB);"?
>
> Crashes your program. It is a bug. You should instantiate
> Unchecked_Deallocation with class-wide type if you pass a class-wide
> pointer.
Thanks, I haven't considered this possibility.
Note: the previous program built with GNAT FSF 13.2.0 ran without exception.
I've changed:
with Ada.Unchecked_Deallocation;
procedure test_20231113_free_class is
type TTA is tagged record
AA : Integer;
end record;
type ATTA is access all TTA;
type CATTA is access all TTA'Class;
procedure Finalize (O : in out CATTA) is
procedure Free is new Ada.Unchecked_Deallocation (TTA'Class, CATTA);
begin
Free (O);
end Finalize;
type TTB is new TTA with record
BB : Integer;
end record;
type ATTB is access all TTB;
type CATTB is access all TTB'Class;
procedure Finalize (O : in out CATTB) is
begin
Finalize (CATTA (O));
end Finalize;
OA : CATTA := new TTA;
OB : CATTB := new TTB;
begin
Finalize (OA);
Finalize (OB);
end test_20231113_free_class;
It runs without exception.
One question remains about "Finalize (OB);":
Which memory size is deallocated TTA'Size or TTB'Size?
Thanks, Pascal.
On 2023-11-14 22:11, Blady wrote: > The following code present a Finalize procedure with a parameter of > access tagged class type in order to deallocate the memory of the given > parameter from the root tagged type TTA and his children. > The same for TTB which is inherited from TTA. But this Finalize call > Finalize of TTA. > It may be not the best idea. > But let's see: > > with Ada.Unchecked_Deallocation; > procedure test_20231113_free_tag is > > type TTA is tagged record > AA : Integer; > end record; > type ATTA is access all TTA; > type CATTA is access all TTA'Class; > procedure Finalize (O : in out CATTA) is > procedure Free is new Ada.Unchecked_Deallocation (TTA, ATTA); > begin > Free (ATTA (O)); > end Finalize; > > type TTB is new TTA with record > BB : Integer; > end record; > type ATTB is access all TTB; > type CATTB is access all TTB'Class; > procedure Finalize (O : in out CATTB) is > begin > Finalize (CATTA (O)); > end Finalize; > > OA : CATTA := new TTA; > OB : CATTB := new TTB; > > begin > Finalize (OA); > Finalize (OB); > end test_20231113_free_tag; > > The procedure Free is the instanciation of Unchecked_Deallocation with > the tagged type TTA. > Thus the call "Finalize (OA);" deallocate the memory of object OA of > type access class TTA. > > But what does "Finalize (OB);"? Crashes your program. It is a bug. You should instantiate Unchecked_Deallocation with class-wide type if you pass a class-wide pointer. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
Hello, The following code present a Finalize procedure with a parameter of access tagged class type in order to deallocate the memory of the given parameter from the root tagged type TTA and his children. The same for TTB which is inherited from TTA. But this Finalize call Finalize of TTA. It may be not the best idea. But let's see: with Ada.Unchecked_Deallocation; procedure test_20231113_free_tag is type TTA is tagged record AA : Integer; end record; type ATTA is access all TTA; type CATTA is access all TTA'Class; procedure Finalize (O : in out CATTA) is procedure Free is new Ada.Unchecked_Deallocation (TTA, ATTA); begin Free (ATTA (O)); end Finalize; type TTB is new TTA with record BB : Integer; end record; type ATTB is access all TTB; type CATTB is access all TTB'Class; procedure Finalize (O : in out CATTB) is begin Finalize (CATTA (O)); end Finalize; OA : CATTA := new TTA; OB : CATTB := new TTB; begin Finalize (OA); Finalize (OB); end test_20231113_free_tag; The procedure Free is the instanciation of Unchecked_Deallocation with the tagged type TTA. Thus the call "Finalize (OA);" deallocate the memory of object OA of type access class TTA. But what does "Finalize (OB);"? What is the memory deallocate of object OB of type TTB? Thanks, Pascal.
Hello everybody! I would like to announce the December Ada Monthly Meetup which will be taking place on the 2nd of December at **14:00 UTC time (15:00 CET)**. As always the meetup will take place over at Jitsi. The Meetup will also be livestreamed to Youtube :) If someone would like to propose a talk or a topic, feel free to do so! We currently have no topics ;) Here are the connection details from previous posts: The meetup will take place over at Jitsi, a conferencing software that runs on any modern browser. The link is [Jitsi Meet](https://meet.jit.si/AdaMonthlyMeetup) The room name is “AdaMonthlyMeetup” and in case it asks for a password, it will be set to “AdaRules”. I do not want to set up a password, but in case it is needed, it will be the one above without the quotes. The room name is generally not needed as the link should take you directly there, but I want to write it down just in case someone needs it. Best regards and see you soon! Fer
Ben Bacarisse <ben.usenet@bsb.me.uk> writes:
> Ah! You didn't add a newline! I can get the same hash by guesswork:
>
> $ printf foo\\\\n >input
> $ sha256sum input
> 04e1806fda6bdbc9e5e3534edd993c7c2bf03173f5489742db53d1e8b0ef8c61 input
> $ hd input
> 00000000 66 6f 6f 5c 6e |foo\n|
> 00000005
>
> What you added to the test string was a backslash and a letter n.
Yeah, thanks! I realized this too by trying to do this in Python:
>>> import hashlib
>>> hashlib.sha256('foo'.encode()).hexdigest()
'2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae'
>>> hashlib.sha256('foo\n'.encode()).hexdigest()
'b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c'
Thanks again.
wvxvw <olegsivokon@gmail.com> writes: > "Jeffrey R.Carter" <spam.jrcarter.not@spam.acm.org.not> writes: > >> I think the problem may be that echo adds an LF: >> >> $ echo foo | hd >> 00000000 66 6f 6f 0a |foo.| >> >> Since sha256sum expects to work on arbitrary files, it would include >> the LF in its input. > > Hi, thanks for the idea, but no, that's not it. You say that's not it, but with the newline removed, sha256sum gives the same hash as your original test code: $ printf foo | sha256sum - 2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae - From your earlier post: > Eg, with GNAT.SHA256 for string "foo" I get: > > ❯ ./bin/test_sha --arg foo > 2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae > With the line end added > I get 04e1806fda6bdbc9e5e3534edd993c7c2bf03173f5489742db53d1e8b0ef8c61 > from Ada. Ah! You didn't add a newline! I can get the same hash by guesswork: $ printf foo\\\\n >input $ sha256sum input 04e1806fda6bdbc9e5e3534edd993c7c2bf03173f5489742db53d1e8b0ef8c61 input $ hd input 00000000 66 6f 6f 5c 6e |foo\n| 00000005 What you added to the test string was a backslash and a letter n. -- Ben.
> On 2023-11-04 17:09, Jeffrey R.Carter wrote: >> On 2023-11-04 15:39, wvxvw wrote: >>> >>> ❯ ./bin/test_sha --arg foo >>> 2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae >>> ❯ echo foo | sha256sum - >>> b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c - >> >> I think the problem may be that echo adds an LF: >> >> $ echo foo | hd >> 00000000 66 6f 6f 0a |foo.| >> >> Since sha256sum expects to work on arbitrary files, it would include the LF in >> its input. wvxvw wrote: > > Hi, thanks for the idea, but no, that's not it. With the line end added > I get 04e1806fda6bdbc9e5e3534edd993c7c2bf03173f5489742db53d1e8b0ef8c61 > from Ada. On 2023-11-04 17:49, Niklas Holsti wrote: > > Some implementations of "echo" accept an option "-n" to suppress the trailing > newline (LF). The OP could try that option as a quick check of this answer > (which seems very plausible). $ echo -n foo | hd 00000000 66 6f 6f |foo| $ echo -n foo | sha256sum - 2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae - Interesting results. -- Jeff Carter "You can never forget too much about C++." 115
On 2023-11-04 17:09, Jeffrey R.Carter wrote:
> On 2023-11-04 15:39, wvxvw wrote:
>>
>> ❯ ./bin/test_sha --arg foo
>> 2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae
>> ❯ echo foo | sha256sum -
>> b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c -
>
> I think the problem may be that echo adds an LF:
>
> $ echo foo | hd
> 00000000 66 6f 6f 0a |foo.|
>
> Since sha256sum expects to work on arbitrary files, it would include the
> LF in its input.
Some implementations of "echo" accept an option "-n" to suppress the
trailing newline (LF). The OP could try that option as a quick check of
this answer (which seems very plausible).
"Jeffrey R.Carter" <spam.jrcarter.not@spam.acm.org.not> writes:
> I think the problem may be that echo adds an LF:
>
> $ echo foo | hd
> 00000000 66 6f 6f 0a |foo.|
>
> Since sha256sum expects to work on arbitrary files, it would include
> the LF in its input.
Hi, thanks for the idea, but no, that's not it. With the line end added
I get 04e1806fda6bdbc9e5e3534edd993c7c2bf03173f5489742db53d1e8b0ef8c61
from Ada.
On 2023-11-04 15:39, wvxvw wrote:
>
> ❯ ./bin/test_sha --arg foo
> 2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae
> ❯ echo foo | sha256sum -
> b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c -
I think the problem may be that echo adds an LF:
$ echo foo | hd
00000000 66 6f 6f 0a |foo.|
Since sha256sum expects to work on arbitrary files, it would include the LF in
its input.
--
Jeff Carter
"You can never forget too much about C++."
115
Hello. (Sorry for duplication, the first attempt to send this sent it as a response to an unrelated thread). I'm learning Ada as well as how to use Usenet, so don't be too harsh. As a learning exercise, I want to write a program that, beside other things, needs to compute SHA256 hashes. I discovered GNAT.SHA256 library and was able to use it (by calling Digest(<some string>)), however the result is different from what I'd get for the same string with running sha256sum. Eg, with GNAT.SHA256 for string "foo" I get: ❯ ./bin/test_sha --arg foo 2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae ❯ echo foo | sha256sum - b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c - My Ada code looks (with some unrelated stuff removed) like this: with GNAT.Command_Line; use GNAT.Command_Line; with GNAT.SHA256; use GNAT.SHA256; procedure Main is loop case Getopt ("-arg=") is when '-' => if Full_Switch = "-arg" then Put_Line (Digest (Parameter)); end if; end case; end loop; end Main; My understanding is that there are plenty of configuration settings to how the checksum is computed, but I know very little about it. My goal is to produce the same checksum as would be produced by sha256sum though, as the checksums are to be used outside of my program. Finally: is GNAT.SHA256 a good way to go if I need this functionality (I don't care about portability, if that's a concern)? Thanks!
Hello. I'm learning Ada as well as how to use Usenet, so don't be too harsh. As a learning exercise, I want to write a program that, beside other things, needs to compute SHA256 hashes. I discovered GNAT.SHA256 library and was able to use it (by calling Digest(<some string>)), however the result is different from what I'd get for the same string with running sha256sum. Eg, with GNAT.SHA256 for string "foo" I get: ❯ ./bin/test_sha --arg foo 2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae ❯ echo foo | sha256sum - b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c - My Ada code looks (with some unrelated stuff removed) like this: with GNAT.Command_Line; use GNAT.Command_Line; with GNAT.SHA256; use GNAT.SHA256; procedure Main is loop case Getopt ("-arg=") is when '-' => if Full_Switch = "-arg" then Put_Line (Digest (Parameter)); end if; end case; end loop; end Main; My understanding is that there are plenty of configuration settings to how the checksum is computed, but I know very little about it. My goal is to produce the same checksum as would be produced by sha256sum though, as the checksums are to be used outside of my program. Finally: is GNAT.SHA256 a good way to go if I need this functionality (I don't care about portability, if that's a concern)? Thanks!
\r>The only issue is that I cannot see how to get to the exception messages
> System.Address except via the last chance handler. zfp does not permit
> exception propagation and so the Exception_Occurence cannot be used.
>
If not, then atleast I can log the exception type and function but not the
line information when I wish to avoid micro reset.
--
Regards, Kc
Le mercredi 1 novembre 2023 à 02:56:27 UTC+1, Randy Brukardt a écrit : > > Because it's not in CVS. > It is now. And it always was in the ZIP file of the source. (That is made > from the files that I use to compile the tool, so it should always be > compilable.) > > One of the big downsides of working at home is that some support functions > get delayed until one gets into the office -- and that means that they're > easily forgotten. As in this case, checking the new files into the CVS (the > existing files were updated, of course, leaving a mess for anyone trying to > buold from the CVS). > > Sorry about that. > > Randy. I am sorry, but even if I put the package "arm_paragraph" in the source code, I get compile errors : for instance in version 0e95e9125e066ce564fe369221821452535b6260 : gprbuild -p -P ada_form.gpr Compile [Ada] arm_form.ada [Ada] arm_cont.adb [Ada] arm_frm.adb arm_frm.adb:1163:13: error: missing case value: "Usage" arm_frm.adb:1544:33: error: missing case value: "Usage" arm_frm.adb:1680:33: error: missing case value: "Usage" arm_frm.adb:1738:17: error: missing case value: "Usage" arm_frm.adb:2099:17: error: missing case value: "Usage" arm_frm.adb:2197:17: error: missing case value: "Usage" arm_frm.adb:9357:53: error: "Numbered_T_and_D_List" not declared in "ARM_Database" arm_frm.adb:9362:53: error: "T_and_D_List" not declared in "ARM_Database" arm_frms.adb:1415:33: error: unmatched actual "Note1_Text" in call gprbuild: *** compilation phase failed And with the latest : gprbuild -p -P ada_form.gpr Compile [Ada] arm_form.ada arm_form.ada:263:41: error: "Rest" not declared in "ARM_Master" gprbuild: *** compilation phase failed What is the ZIP file of the source that you mentioned ? Where can I find it ? Regards, Vincent.
I was able to work around the issue by using abstract tagged null records instead of interfaces - no other changes necessary. It seems that interfaces can only be at the very top of a hierarchy even if you're only extending another interface.
On zfp with no exception propagation. You can use a local exception handler to return thereby avoiding the last chance handler for this one procedure or even exception type. Obviously it would be better to take the time and prove an absence of runtime errors. However, when you do not have that time. I believe it is not risky if you are sure the stack will be cleaned up upon return. Indeed the handler can return or set known safe values. I assume that out of bounds writes are caught by constraint checks before they occur? Sometimes you do not want to reset the micro but just drop some functionality by return but would still like to get the exception message to log. The only issue is that I cannot see how to get to the exception messages System.Address except via the last chance handler. zfp does not permit exception propagation and so the Exception_Occurence cannot be used. Is it possible with gnat 13, even if I need to enable the secondary stack, just for this capability? -- Regards, Kc
On 3/11/23 07:13, Fernando Oleo / Irvise wrote:
> Small reminder that the meetup will take place this Saturday, in just a
> couple of days!
>
> See you there!
> Fer
Looking forward to it, Fer. Ironclad sounds *very* interesting.
Small reminder that the meetup will take place this Saturday, in just a
couple of days!
See you there!
Fer
On 10/11/23 19:16, Fernando Oleo / Irvise wrote:
> Hello everybody!
>
> I would like to announce the November Ada Monthly Meetup which will be
> taking place on the 4th of November at **14:00 UTC time (15:00 CET)**.
> As always the meetup will take place over at Jitsi. Hopefully this time
> I will not have the same amount of technical issues…
>
> If someone would like to propose a talk or a topic, feel free to do so!
> Streaksu, the creator of the [Ironclad](https://ironclad.cx/) kernel,
> has volunteered to give an introductory talk and demonstration of the OS :)
>
> Here are the connection details from previous posts:
> The meetup will take place over at Jitsi, a conferencing software that
> runs on any modern browser. The link is [Jitsi Meet
> ](https://meet.jit.si/AdaMonthlyMeetup) The room name is
> “AdaMonthlyMeetup” and in case it asks for a password, it will be set to
> “AdaRules”.
> I do not want to set up a password, but in case it is needed, it will be
> the one above without the quotes. The room name is generally not needed
> as the link should take you directly there, but I want to write it down
> just in case someone needs it.
>
> Best regards and see you soon!
> Fer
>
> P.S: careful with the time! In the EU we will enter daylight savings
> time at the end of October. For that reason, I have decided to change
> the meeting to UTC 14:00h! Please, check you local timezones!
>
> P.P.S: the October meeting went pretty well! We had quite a few people
> and two presentations, one from Francesc, who introduced
> [Alice](https://github.com/alice-adventures/Alice) and Rod Kay, who
> showed his work on [SWIG4Ada](https://github.com/charlie5/swig4ada). The
> meeting was livestreamed to Youtube and can be watched
> [here](https://www.youtube.com/watch?v=0Pnuy663gZM) (the video
> resolution is only 360p for the time being).
On Thursday, November 2, 2023 at 10:11:55 AM UTC-4, J-P. Rosen wrote:
> Le 02/11/2023 à 13:20, Kura a écrit :
> > type IBase is interface;
> > pragma Convention (C_Plus_Plus, IBase);
> > type IBase_Ptr is access all IBase'Class;
> >
> > type IDerived is interface and IBase;
> > pragma Convention (C_Plus_Plus, IDerived);
> > type IDerived_Ptr is access all IDerived'Class;
> I don't know if this is the cause of your problem, but you should give
> convention C_Plus_Plus to the pointer types too (IBase_Ptr and
> IDerived_Ptr).
That did not solve my problem, but thank you for the tip.
Le 02/11/2023 à 13:20, Kura a écrit : > type IBase is interface; > pragma Convention (C_Plus_Plus, IBase); > type IBase_Ptr is access all IBase'Class; > > type IDerived is interface and IBase; > pragma Convention (C_Plus_Plus, IDerived); > type IDerived_Ptr is access all IDerived'Class; I don't know if this is the cause of your problem, but you should give convention C_Plus_Plus to the pointer types too (IBase_Ptr and IDerived_Ptr). -- J-P. Rosen Adalog 2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX https://www.adalog.fr https://www.adacontrol.fr
Hi all, I'm trying to figure out how to correctly perform an upcast in GNAT using interface types that have the CPP convention. I have two types corresponding to C++ classes: IBase and IDerived each with corresponding access types suffixed with _Ptr. The library that I'm wrapping returns a pointer to some concrete implementation of IDerived, but the moment I convert it to an IBase_Ptr to pass it to functions within the library, the program segfaults while performing some kind of tag check. I've found information on this topic to be very sparse, and the GNAT manual has no discussion about allowed conversions or examples showing how to do this. This seems like it should be an allowed conversion and the program works as expected if I either replace the usage of Base_Ptr with Derived_Ptr within the function wrapper specification (not feasible because there are many types deriving from Base_Ptr and adding overloads would affect its vtable) or use Unchecked_Conversion between the two pointer types (unsure if this is safe). I'm also aware I could lay out the vtables manually and do away with tagged types, but I would like to avoid that if possible. Here is a minimal example that segfaults, all compiled with the same toolchain on windows/mingw64: --==== repro.adb ============================================================== with Wrap; use Wrap; procedure Repro is P : IDerived_Ptr := GetDerivedInstance; Q : IBase_Ptr := IBase_Ptr (P); begin null; end Repro; --==== wrap.ads =============================================================== package Wrap is type IBase is interface; pragma Convention (C_Plus_Plus, IBase); type IBase_Ptr is access all IBase'Class; type IDerived is interface and IBase; pragma Convention (C_Plus_Plus, IDerived); type IDerived_Ptr is access all IDerived'Class; function GetDerivedInstance return IDerived_Ptr with Import => True, Convention => C_Plus_Plus, External_Name => "GetDerivedInstance"; end Wrap; --==== lib.cpp ================================================================ class IBase {}; class IDerived : public IBase {}; class Impl : public IDerived { public: Impl() = default; }; extern "C" IDerived* GetDerivedInstance() { return new Impl(); } --==== end example ============================================================ Error and stack trace: Thread 1 received signal SIGSEGV, Segmentation fault. ada.tags.offset_to_top (this=(system.address) 0x6591710) at a-tags.adb:806 806 a-tags.adb: No such file or directory. (gdb) bt #0 ada.tags.offset_to_top (this=(system.address) 0x6591710) at a-tags.adb:806 #1 ada.tags.base_address (this=(system.address) 0x6591710) at a-tags.adb:286 #2 ada.tags.displace (this=(system.address) 0x6591710, t=0x7ff7fe8301c8 <wrap__ibaseT+8> (wrap.ibase)) at a-tags.adb:354 #3 0x00007ff7fe82649c in repro () at C:\repro\src\repro.adb:5 Any ideas?
"Simon Wright" <simon@pushface.org> wrote in message
news:ly1qdhnwj8.fsf@pushface.org...
> "Vincent D." <vincent.diemunsch@gmail.com> writes:
>
>> The problem appears in version 0e95e912 "Various updates for FDIS
>> 2.0." from the 23/09/2022 where with ARM_Paragraph is added to
>> arm_frm.adb but the package was not added to the sources.
>
> Because it's not in CVS.
It is now. And it always was in the ZIP file of the source. (That is made
from the files that I use to compile the tool, so it should always be
compilable.)
One of the big downsides of working at home is that some support functions
get delayed until one gets into the office -- and that means that they're
easily forgotten. As in this case, checking the new files into the CVS (the
existing files were updated, of course, leaving a mess for anyone trying to
buold from the CVS).
Sorry about that.
Randy.
"Niklas Holsti" <niklas.holsti@tidorum.invalid> wrote in message
news:kpt5bvFifdfU1@mid.individual.net...
> On 2023-10-25 20:01, robin vowels wrote:
>> On Thursday, 8 June 2023 at 16:57:17 UTC+10, Niklas Holsti wrote:
>>> On 2023-06-08 6:55, Nasser M. Abbasi wrote:
>>>> Some folks in this thread
>>>>
>>>> https://discourse.julialang.org/t/comparison-of-rust-to-julia-for-scientific-computing/78508
>>>>
>>>> "I'm not an expert, but my feeling is that Rust is a "safer" language,
>>>> which to me means it must be slower."
>>>>
>>>> etc..
>>>>
>>>> Some in that thread seem to argue that a safer language
>>>> will/could be slower than otherwise.
>>>>
>>>> Since Ada is known to be one of the safest languages,
>>>> do others here feel there is any truth to this?
>>>>
>>>> I thought that by having more type information in the language,
>>>> the compile will be able to make more optimizations (because it
>>>> know more), and hence the generated code should actually be
>>>> faster, not slower with a language that is less safe?
>>>>
>>>> I am not a compiler expert but what do others here think?
>> .
>>> If a language needs run-time checks to ensure safety, those checks
>>> usually take some time, making for slower execution.
>> .
>> Some language features need run-time checks. These checks cannot be
>> carried out at compile time.
>> .
>> PL/I has some features that require run-time checks. When the computer
>> hardware has certain facilities, that support does not take extra
>> execution time.
>> For example, floating-point overflow and integer overflow are detected by
>> the
>> hardware on the IBM S/360 and subsequent machines including up to the
>> latest
>> System z. Such detections cause an interrupt that can be handled by the
>> PL/I
>> program. On the PC, integer overflow can cause an interrupt.
>> .
>>> If a language has a type system and compilation-time (legality) rules
>>> such that the compiler can prove that some run-time checks are not
>>> needed, that reduces or eliminates the slow-down. This is the case for
>>> Ada.
>> .
>> Range is not one of them.
>
>
> /Some/ range checks in Ada can certainly be verified at compile time. For
> example:
>
> type ABCD is (A, B, C, D);
> subtype BCD is ABCD range B .. D;
>
> procedure Foo (X : in BCD)
> is
> Y : ABCD := X;
> Z : ABCD := ABCD'Pred(Y);
> ...
>
> The initialization of Y formally involves a range check of X, but since
> BCD is a subtype of ABCD, the check can be elided at compile time.
> Likewise, the initialization of Z, with its computation of the Pred,
> formally includes a range check of Y, but since Y /= A can easily be
> proved, that range check can also be elided.
>
> The most important type of check that can be elided at Ada compile time is
> array index check. Because arrays have specific index types in Ada, the
> compiler can often prove that the index expression will be in range.
Right. And programmers can often write their code to ensure that no range
check will be needed. The most obvious case occurs in loops:
for I in Arr'range loop
... Arr(I) ... -- Needs no range check, since I can never be outside
of the legal range of the array index.
end loop;
(Of course, the element for loop disposes with the array indexing
altogether, which is even better.)
Randy.
A full implementation of the parallel features of Ada 2022 is yet to be released. In the meantime, here is a light-weight-threading library that provides essentially all of the parallel features of Ada 2022, using various generics, etc. Scheduling is provided using a plug-in architecture. If no scheduler is plugged in, the light-weight threads are simply executed sequentially. If a light-weight-thread scheduler is plugged in, then the light-weight threads spawned by instances of the various generic packages are managed by that scheduler. There are currently two LWT scheduler plug-ins: * a wrapper for the GNU implementation of OpenMP (lwt-openmp.ads) * a work-stealing based plug-in, written entirely in Ada Below is a link to the "readme.md" documentation for the GitHub lwt library. It is currently part of the ParaSail GitHub repository, but the files in "lwt" are actually independent of ParaSail. ParaSail has its own work-stealing-based scheduler built-in, but at some point we plan to shift over to using the "lwt" library. But at the moment, there is no dependence either way between the ParaSail interpreter/compiler and the lwt library. https://github.com/parasail-lang/parasail/tree/main/lwt#light-weight-threading-library-for-ada-2022 Feel free to open GitHub Issues if you find problems with the implementation, or have suggestions for improvements. Enjoy! -Tucker Taft The ParaSail GitHub repository was created by my colleague Olivier Henley, and he has also helped to improve the documentation and testing scripts. Much appreciated!
Ugh ... sorry about the multiples. My reply stalled when sending, so I tried re-sending ... several times :/.
On 2/10/23 19:44, Vadim Godunko wrote: >> > > GtkAda is binding for Gtk+ 3.24.x version, it doesn't support Gtk 4. > > GtkAda doesn't provide OpenGL API binding, but supports OpenGL. There is no example in testgtk for this reason - it requires OpenGL API binding. I'm very happy to report that openGL support in gtkada works fine. I made a simple blunder in my initial test (not attaching the gl_Area widget to my main window widget *sigh* :) ). It is also possible to use an openGL engine (ie a renderer in it's own ada task) with gtkada. A simple protected object to prevent mutual access between the gtkada task (main environment task) and the openGL engine task, is all that was required. *Thank* you Vadim for letting me know that the openGL support is there. Now, onto my game ! ... :D "The game is afoot!" Regards. P.S. Would anyone know if gtkada might be 'upgraded' to support gtk4 ? Just curious (gtk3 is fine for my purposes).
On 2/10/23 19:44, Vadim Godunko wrote: >> > > GtkAda is binding for Gtk+ 3.24.x version, it doesn't support Gtk 4. > > GtkAda doesn't provide OpenGL API binding, but supports OpenGL. There is no example in testgtk for this reason - it requires OpenGL API binding. I'm very happy to report that openGL support in gtkada works fine. I made a simple blunder in my initial test (not attaching the gl_Area widget to my main window widget *sigh* :) ). It is also possible to use an openGL engine (ie a renderer in it's own ada task) with gtakada. A simple protected object to prevent mutual access between the gtkada task (main environment task) and the openGL engine task, is all that was required. *Thank* you Vadim for letting me know that the openGL support is there. Now, onto my game ! ... :D "The game is afoot!" Regards. P.S. Would anyone know if gtkada might be 'upgraded' to support gtk4 ? Just curious (gtk3 is fine for my purposes).
On 2/10/23 19:44, Vadim Godunko wrote:
>>
>
> GtkAda is binding for Gtk+ 3.24.x version, it doesn't support Gtk 4.
>
> GtkAda doesn't provide OpenGL API binding, but supports OpenGL. There is no example in testgtk for this reason - it requires OpenGL API binding.
I'm very happy to report that openGL support in gtkada works fine. I
made a simple blunder in my initial test (not attaching the gl_Area
widget to my main window widget *sigh* :) ).
It is also possible to use an openGL engine (ie a renderer in it's
own ada task) with gtakada. A simple protected object to prevent mutual
access between the gtkada task (main environment task) and the openGL
engine task, is all that was required.
*Thank* you Vadim for letting me know that the openGL support is there.
Now, onto my game ! ... :D
"The game is afoot!"
Regards.
P.S. Would anyone know if gtkada might be 'upgraded' to support gtk4 ?
Just curious (gtk3 is fine for my purposes).
On 2/10/23 19:44, Vadim Godunko wrote:
>>
>
> GtkAda is binding for Gtk+ 3.24.x version, it doesn't support Gtk 4.
>
> GtkAda doesn't provide OpenGL API binding, but supports OpenGL. There is no example in testgtk for this reason - it requires OpenGL API binding.
I'm very happy to report that openGL support in gtkada works fine. I
made a simple blunder in my initial test (not attaching the gl_Area
widget to my main window widget *sigh* :) ).
It is also possible to use an openGL engine (ie a renderer in it's
own ada task) with gtakada. A simple protected object to prevent mutual
access between the gtkada task (main environment task) and the openGL
engine task, is all that was required.
*Thank* you Vadim for letting me know that the openGL support is there.
Now, onto my game ! ... :D
"The game is afoot!"
Regards.
P.S. Would anyone know if gtkada might be 'upgraded' to support gtk4 ?
Just curious (gtk3 is fine for my purposes).
"Vincent D." <vincent.diemunsch@gmail.com> writes:
> The problem appears in version 0e95e912 "Various updates for FDIS
> 2.0." from the 23/09/2022 where with ARM_Paragraph is added to
> arm_frm.adb but the package was not added to the sources.
Because it's not in CVS.
Le jeudi 26 octobre 2023 à 16:58:16 UTC+2, Vincent D. a écrit :
> Le jeudi 26 octobre 2023 à 10:15:21 UTC+2, Maxim Reznik a écrit :
> > Hello,
> > I have a github repository synced with ada-auth Web CVS. I was able to build the formatting tool from the source.
> > https://github.com/reznikmm/ada-auth/
> > Max
>
> Hello Maxim,
> Thank you for the link on GitHub, but the build didn't work for me : I get the same error regarding "ARM_Paragraph" package missing.
>
> $ git clone https://github.com/reznikmm/ada-auth.git
> $ cd ada-auth
> $ gprbuild -p -P ada_form.gpr
> Setup
> [mkdir] object directory for project Ada_Form
> Compile
> [Ada] arm_form.ada
> arm_form.ada:6:06: error: file "arm_paragraph.ads" not found
> arm_form.ada:6:06: error: "Arm_Formatter (body)" depends on "Arm_Master (spec)"
> arm_form.ada:6:06: error: "Arm_Master (spec)" depends on "Arm_Format (spec)"
> arm_form.ada:6:06: error: "Arm_Format (spec)" depends on "Arm_Paragraph (spec)"
> gprbuild: *** compilation phase failed
>
> Kind regards,
>
> Vincent.
Versions that compile:
4500f560 Corrected note format for ISO version
29db0326 Split out the normative references clause.
ff3db3ca Various updates for FDIS work and draft 34.
Versions that do not compile:
0e95e912 Various updates for FDIS 2.0.
4d93b18c A number of small formatting changes, mostly only for the FDIS.
260566bd Various updates for FDIS/Draft 35.
The problem appears in version 0e95e912 "Various updates for FDIS 2.0." from the 23/09/2022 where with ARM_Paragraph is added to arm_frm.adb but the package was not added to the sources.
Regards,
Vincent
Le jeudi 26 octobre 2023 à 10:15:21 UTC+2, Maxim Reznik a écrit : > Hello, > I have a github repository synced with ada-auth Web CVS. I was able to build the formatting tool from the source. > https://github.com/reznikmm/ada-auth/ > Max Hello Maxim, Thank you for the link on GitHub, but the build didn't work for me : I get the same error regarding "ARM_Paragraph" package missing. $ git clone https://github.com/reznikmm/ada-auth.git $ cd ada-auth $ gprbuild -p -P ada_form.gpr Setup [mkdir] object directory for project Ada_Form Compile [Ada] arm_form.ada arm_form.ada:6:06: error: file "arm_paragraph.ads" not found arm_form.ada:6:06: error: "Arm_Formatter (body)" depends on "Arm_Master (spec)" arm_form.ada:6:06: error: "Arm_Master (spec)" depends on "Arm_Format (spec)" arm_form.ada:6:06: error: "Arm_Format (spec)" depends on "Arm_Paragraph (spec)" gprbuild: *** compilation phase failed Kind regards, Vincent.
Hello, I have a github repository synced with ada-auth Web CVS. I was able to build the formatting tool from the source. https://github.com/reznikmm/ada-auth/ -- Max
Hello, I have tried to download the source code of the formatting tool from the site http://ada-auth.org/arm.html, but it seems that the package ARM_Paragraph is missing. Does anyone knows how to get this file ? Kind regards, Vincent.
On 2023-10-25 20:01, robin vowels wrote:
> On Thursday, 8 June 2023 at 16:57:17 UTC+10, Niklas Holsti wrote:
>> On 2023-06-08 6:55, Nasser M. Abbasi wrote:
>>> Some folks in this thread
>>>
>>> https://discourse.julialang.org/t/comparison-of-rust-to-julia-for-scientific-computing/78508
>>>
>>> "I’m not an expert, but my feeling is that Rust is a “safer” language,
>>> which to me means it must be slower."
>>>
>>> etc..
>>>
>>> Some in that thread seem to argue that a safer language
>>> will/could be slower than otherwise.
>>>
>>> Since Ada is known to be one of the safest languages,
>>> do others here feel there is any truth to this?
>>>
>>> I thought that by having more type information in the language,
>>> the compile will be able to make more optimizations (because it
>>> know more), and hence the generated code should actually be
>>> faster, not slower with a language that is less safe?
>>>
>>> I am not a compiler expert but what do others here think?
> .
>> If a language needs run-time checks to ensure safety, those checks
>> usually take some time, making for slower execution.
> .
> Some language features need run-time checks. These checks cannot be
> carried out at compile time.
> .
> PL/I has some features that require run-time checks. When the computer
> hardware has certain facilities, that support does not take extra execution time.
> For example, floating-point overflow and integer overflow are detected by the
> hardware on the IBM S/360 and subsequent machines including up to the latest
> System z. Such detections cause an interrupt that can be handled by the PL/I
> program. On the PC, integer overflow can cause an interrupt.
> .
>> If a language has a type system and compilation-time (legality) rules
>> such that the compiler can prove that some run-time checks are not
>> needed, that reduces or eliminates the slow-down. This is the case for Ada.
> .
> Range is not one of them.
/Some/ range checks in Ada can certainly be verified at compile time.
For example:
type ABCD is (A, B, C, D);
subtype BCD is ABCD range B .. D;
procedure Foo (X : in BCD)
is
Y : ABCD := X;
Z : ABCD := ABCD'Pred(Y);
...
The initialization of Y formally involves a range check of X, but since
BCD is a subtype of ABCD, the check can be elided at compile time.
Likewise, the initialization of Z, with its computation of the Pred,
formally includes a range check of Y, but since Y /= A can easily be
proved, that range check can also be elided.
The most important type of check that can be elided at Ada compile time
is array index check. Because arrays have specific index types in Ada,
the compiler can often prove that the index expression will be in range.
On Thursday, 8 June 2023 at 16:57:17 UTC+10, Niklas Holsti wrote: > On 2023-06-08 6:55, Nasser M. Abbasi wrote: > > Some folks in this thread > > > > https://discourse.julialang.org/t/comparison-of-rust-to-julia-for-scientific-computing/78508 > > > > "I’m not an expert, but my feeling is that Rust is a “safer” language, > > which to me means it must be slower." > > > > etc.. > > > > Some in that thread seem to argue that a safer language > > will/could be slower than otherwise. > > > > Since Ada is known to be one of the safest languages, > > do others here feel there is any truth to this? > > > > I thought that by having more type information in the language, > > the compile will be able to make more optimizations (because it > > know more), and hence the generated code should actually be > > faster, not slower with a language that is less safe? > > > > I am not a compiler expert but what do others here think? . > If a language needs run-time checks to ensure safety, those checks > usually take some time, making for slower execution. . Some language features need run-time checks. These checks cannot be carried out at compile time. . PL/I has some features that require run-time checks. When the computer hardware has certain facilities, that support does not take extra execution time. For example, floating-point overflow and integer overflow are detected by the hardware on the IBM S/360 and subsequent machines including up to the latest System z. Such detections cause an interrupt that can be handled by the PL/I program. On the PC, integer overflow can cause an interrupt. . > If a language has a type system and compilation-time (legality) rules > such that the compiler can prove that some run-time checks are not > needed, that reduces or eliminates the slow-down. This is the case for Ada. . Range is not one of them. . > The effect of type information on optimization is harder (at least for > me) to understand. If the type information lets the compiler assume that > some objects are not aliased, that can help optimization because more > computation can be done in registers alone, without using main memory. > This applies to Ada, but also applies to standard C, for example, > although some people use non-standard C features (compiler options) to > negate this. > > However, when comparing the "speed" of two languages and their two > implementations I think that the implementations usually matter more > than the languages.
On Monday, October 23, 2023 at 6:04:30 PM UTC+11, reinert wrote:
> mandag 23. oktober 2023 kl. 07:03:01 UTC+2 skrev reinert:
> > Assume the loop:
> >
> > for t of C loop
> > if f(t) then
> > do something....
> > elsif f(t) > f1 then
> > exit;
> > end if;
> > end loop;
> >
> > I would like to simplify this construct (somehow) like this:
> >
> > for t of C when f(t) loop
> > do something....
> > end loop;
> >
> > However, this is not computationally effective, since t in this case runs through the whole C.
> > Any ideas for a compromise?
> >
> > reinert
> Just a correction of the subject, it should be: How to exit from "for t *of* C when f(t) loop ? -reinert
Normally one does something
t := C'first;
loop
do something...
exit when Condition;
t := t + 1;
end loop;
The conditon is just a boolean expression. It can be as simple or as complicated as one desires.
On 7/11/21 21:41, Frank Jørgen Jørgensen wrote:
>
> When I compile the bank application in the PolyORB or my own DSA application I get an error referring to a-sttebu.ali which I suspect is something new in GNAT 2021 to handle the improved 'Img functionality in Ada 202X.
>
I encountered the exact same problem today, except on arch linux,
rather than windows.
After much stabbing in the dark, the chase for several wild gueese,
playing option roulette and moving files around, I found this
'workaround' ...
In the folder from which po_gnatdist is invoked ...
$ cp /usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/adainclude/a-sttebu.ads .
$ mkdir --parents dsa/x86_64-unknown-linux-gnu/obj
$ cp /usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/adalib/a-sttebu.ali
dsa/x86_64-unknown-linux-gnu/obj/
Obviously, this is only a temporary fix. I'll try to send a bug
report to the polyorb issues area on github and hope the problem is able
to be resolved by the experts.
Regards.
El 15/10/23 a las 17:51, 196...@googlemail.com escribió:
> On Wednesday, 11 October 2023 at 07:59:41 UTC+1, Leonid Dulman wrote:
>> AdaStudio-2024 based on Qt-6.6.0-everywhere opensource (expanded with modules from Qt-5.15: qtgamepad, qtx11extras,qtwinextras),VTK-9.3.0,FFMPEG-6.0.0,OpenCV-4.8.0,SDL2-2.24.0,QtAV-1.13 MDK-SDK(wang-bin)
> [...]
>> Leonid(leonid...@gmail.com)
I noticed the original post did not pass the eternal-september.org
filters, probably due to the link to a Google Drive and the strange
domain of the web page. Dulman, I'd recommend you to use some free
repository for open source, like github.com, or sf.net. They will be
more trusted and your bindings will have more visibility.
Niklas Holsti <niklas.holsti@tidorum.invalid> writes: > Ada.Directories.Modification_Time returns a value of type > Ada.Calendar.Time. However, "the time base associated with the type > Time of package Calendar is implementation defined" (RM 9.6(23)) so it > should be documented in the implementation documents, that is in the > GNAT documentation. Have you looked there? The GNAT RM says in Implementation Defined Characteristics[1] "The time base used is that provided by the C library function gettimeofday." [1] https://docs.adacore.com/live/wave/gnat_rm/html/gnat_rm/gnat_rm/implementation_defined_characteristics.html
On 2023-10-17 17:13, Matt Borchers wrote: > On Monday, October 16, 2023 at 2:49:52 PM UTC-4, Niklas Holsti wrote: >> On 2023-10-16 21:35, Matt Borchers wrote: >>> Below is the function from System.OS_Lib. >>> Does anybody know where the C implementation can be found? >>> Does anybody know where the C implementation of "localtime" is found? >>> >>> function File_Time_Stamp (Name : C_File_Name) return OS_Time is >>> function File_Time (Name : Address) return OS_Time; >>> pragma Import (C, File_Time, "__gnat_file_time_name"); >>> begin >>> return File_Time (Name); >>> end File_Time_Stamp; >> (This question seems to be a follow-up ("Re:") to some earlier post, but >> my newsreader does not seem to find or show that earlier post.) >> >> What is the problem? >> >> Have you tried using the standard Ada services: >> Ada.Directories.Modification_Time and >> Ada.Calendar.Time_Zones.Local_Time_Offset? > > Thank you for the suggestion of using "Ada.Directories.Modification_Time". Happy to help! > I didn't think to look in that package. Ada.Directories does, IMO, seem the best place for it, since it should not depend on the type of the file -- text, sequential, etc. > This function adjusts for daylight savings time and returns the time > as displayed in Windows Explorer. > > There needs to be better comments (and documentation) for these time > related functions. It is often not clear what time is returned. Yes, but some of that documentation should not be in the Ada standard, but in the compiler's documentation. Ada.Directories.Modification_Time returns a value of type Ada.Calendar.Time. However, "the time base associated with the type Time of package Calendar is implementation defined" (RM 9.6(23)) so it should be documented in the implementation documents, that is in the GNAT documentation. Have you looked there?
On Monday, October 16, 2023 at 2:49:52 PM UTC-4, Niklas Holsti wrote:
> On 2023-10-16 21:35, Matt Borchers wrote:
> > Below is the function from System.OS_Lib.
> > Does anybody know where the C implementation can be found?
> > Does anybody know where the C implementation of "localtime" is found?
> >
> > function File_Time_Stamp (Name : C_File_Name) return OS_Time is
> > function File_Time (Name : Address) return OS_Time;
> > pragma Import (C, File_Time, "__gnat_file_time_name");
> > begin
> > return File_Time (Name);
> > end File_Time_Stamp;
> (This question seems to be a follow-up ("Re:") to some earlier post, but
> my newsreader does not seem to find or show that earlier post.)
>
> What is the problem?
>
> Have you tried using the standard Ada services:
> Ada.Directories.Modification_Time and
> Ada.Calendar.Time_Zones.Local_Time_Offset?
Thank you for the suggestion of using "Ada.Directories.Modification_Time". I didn't think to look in that package. This function adjusts for daylight savings time and returns the time as displayed in Windows Explorer.
There needs to be better comments (and documentation) for these time related functions. It is often not clear what time is returned. It is safe to assume UTC or local time, but the daylight savings issue caused confusion.
Are you dependent on using Microsoft Visual Studio? I remember long ago that maybe you were.
On 2023-10-16 20:35, Matt Borchers wrote: > Below is the function from System.OS_Lib. > Does anybody know where the C implementation can be found? > Does anybody know where the C implementation of "localtime" is found? > > function File_Time_Stamp (Name : C_File_Name) return OS_Time is > function File_Time (Name : Address) return OS_Time; > pragma Import (C, File_Time, "__gnat_file_time_name"); > begin > return File_Time (Name); > end File_Time_Stamp; If I correctly interpret the description, OS_Time is FILETIME under Windows, i.e. 64-bit value. https://learn.microsoft.com/en-us/windows/win32/api/minwinbase/ns-minwinbase-filetime As for implementation it likely calls to GetFileTime after obtaining a handle to the file. https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getfiletime -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
"Niklas Holsti" <niklas.holsti@tidorum.invalid> wrote in message
news:kp5eucFogqpU1@mid.individual.net...
> On 2023-10-16 21:35, Matt Borchers wrote:
>> Below is the function from System.OS_Lib.
>> Does anybody know where the C implementation can be found?
>> Does anybody know where the C implementation of "localtime" is found?
>>
>> function File_Time_Stamp (Name : C_File_Name) return OS_Time is
>> function File_Time (Name : Address) return OS_Time;
>> pragma Import (C, File_Time, "__gnat_file_time_name");
>> begin
>> return File_Time (Name);
>> end File_Time_Stamp;
>
>
> (This question seems to be a follow-up ("Re:") to some earlier post, but
> my newsreader does not seem to find or show that earlier post.)
>
> What is the problem?
>
> Have you tried using the standard Ada services:
> Ada.Directories.Modification_Time and
> Ada.Calendar.Time_Zones.Local_Time_Offset?
...as those will work on (almost) any target system, while the actual
implementation is going to be rather OS-dependent. And there never is a good
reason to use a GNAT-only (or any compiler-specific, for any compiler)
facility when there is an equivalent standard facility. Most of those
facilities pre-date the Ada ones.
Randy.
Matt Borchers <mattborchers@gmail.com> writes: > Below is the function from System.OS_Lib. > Does anybody know where the C implementation can be found? > Does anybody know where the C implementation of "localtime" is found? > > function File_Time_Stamp (Name : C_File_Name) return OS_Time is > function File_Time (Name : Address) return OS_Time; > pragma Import (C, File_Time, "__gnat_file_time_name"); > begin > return File_Time (Name); > end File_Time_Stamp; For the first question, very likely to be in gcc/ada/adaint.c in the GCC sources (https://github.com/gcc-mirror/gcc) localtime() is in libc; depends on your OS.
On 2023-10-16 21:35, Matt Borchers wrote:
> Below is the function from System.OS_Lib.
> Does anybody know where the C implementation can be found?
> Does anybody know where the C implementation of "localtime" is found?
>
> function File_Time_Stamp (Name : C_File_Name) return OS_Time is
> function File_Time (Name : Address) return OS_Time;
> pragma Import (C, File_Time, "__gnat_file_time_name");
> begin
> return File_Time (Name);
> end File_Time_Stamp;
(This question seems to be a follow-up ("Re:") to some earlier post, but
my newsreader does not seem to find or show that earlier post.)
What is the problem?
Have you tried using the standard Ada services:
Ada.Directories.Modification_Time and
Ada.Calendar.Time_Zones.Local_Time_Offset?
Below is the function from System.OS_Lib. Does anybody know where the C implementation can be found? Does anybody know where the C implementation of "localtime" is found? function File_Time_Stamp (Name : C_File_Name) return OS_Time is function File_Time (Name : Address) return OS_Time; pragma Import (C, File_Time, "__gnat_file_time_name"); begin return File_Time (Name); end File_Time_Stamp;
On Wednesday, 11 October 2023 at 07:59:41 UTC+1, Leonid Dulman wrote: > AdaStudio-2024 based on Qt-6.6.0-everywhere opensource (expanded with modules from Qt-5.15: qtgamepad, qtx11extras,qtwinextras),VTK-9.3.0,FFMPEG-6.0.0,OpenCV-4.8.0,SDL2-2.24.0,QtAV-1.13 MDK-SDK(wang-bin) [...] > Leonid(leonid...@gmail.com) And you are still not giving proper build instructions.
This Ada library provides Unicode character strings of dynamic length. It is now available on Alire [1] in version 0.6.0. Changes: - Add string convenient subprograms [2]: Contains, Ends_With, Starts_With, Is_Lower, Is_Upper, Is_Basic, Is_Empty, Remove, Replace. - Add list of strings with convenient subprograms [3]: Append_Unique, Filter, Join, Remove_Duplicates, Replace, Slice, Sort, Is_Sorted, Merge and Split on strings. So far in UXStrings, its API are similar to those of the strings Ada standard libraries. If you find some missing, make your proposals on Github. NB: UXStrings3 is now the default implementation. Enjoy, Pascal. [1] https://alire.ada.dev/crates/uxstrings.html [2] https://github.com/Blady-Com/UXStrings/blob/master/src/uxstrings3.ads#L346 [3] https://github.com/Blady-Com/UXStrings/blob/master/src/uxstrings-lists.ads [4] https://github.com/Blady-Com/UXStrings/issues
Hello everybody! I would like to announce the November Ada Monthly Meetup which will be taking place on the 4th of November at **14:00 UTC time (15:00 CET)**. As always the meetup will take place over at Jitsi. Hopefully this time I will not have the same amount of technical issues… If someone would like to propose a talk or a topic, feel free to do so! Streaksu, the creator of the [Ironclad](https://ironclad.cx/) kernel, has volunteered to give an introductory talk and demonstration of the OS :) Here are the connection details from previous posts: The meetup will take place over at Jitsi, a conferencing software that runs on any modern browser. The link is [Jitsi Meet ](https://meet.jit.si/AdaMonthlyMeetup) The room name is “AdaMonthlyMeetup” and in case it asks for a password, it will be set to “AdaRules”. I do not want to set up a password, but in case it is needed, it will be the one above without the quotes. The room name is generally not needed as the link should take you directly there, but I want to write it down just in case someone needs it. Best regards and see you soon! Fer P.S: careful with the time! In the EU we will enter daylight savings time at the end of October. For that reason, I have decided to change the meeting to UTC 14:00h! Please, check you local timezones! P.P.S: the October meeting went pretty well! We had quite a few people and two presentations, one from Francesc, who introduced [Alice](https://github.com/alice-adventures/Alice) and Rod Kay, who showed his work on [SWIG4Ada](https://github.com/charlie5/swig4ada). The meeting was livestreamed to Youtube and can be watched [here](https://www.youtube.com/watch?v=0Pnuy663gZM) (the video resolution is only 360p for the time being).
On 2023-10-05 00:12, Keith Thompson wrote:
> "Jeffrey R.Carter" <spam.jrcarter.not@spam.acm.org.not> writes:
>>
>> I should have checked this earlier, but this does not echo with ObjectAda.
>
> On what target system?
Windows.
--
Jeff Carter
"You cheesy lot of second-hand electric donkey-bottom biters."
Monty Python & the Holy Grail
14
"Jeffrey R.Carter" <spam.jrcarter.not@spam.acm.org.not> wrote in message
news:ufjnu0$62ki$1@dont-email.me...
> On 2023-10-04 13:38, Simon Wright wrote:
>>
>> Obviously you need to turn echoing off for password input. But neither
>> the ARM nor the GNAT RM says anything about Get_Immediate's echoing
>> behaviour, so it's hard to explain why OA does the same thing. Does its
>> manual specify this behaviour?
>
> Unfortunately, Ada does not provide a standard way to turn off echo.
>
> I agree that the ARM says nothing about echo for any of its operations on
> Standard_Input, but clearly there is a broad consensus of Ada.Text_IO
> writers and users who think this is desirable behavior.
For what it's worth, Janus/Ada turns off echoing, and that was decided
without referring to any other implementation's choice in the matter.
Rather, it was done to provide a way using standard calls to provide
functionality that had always been available in Janus/Ada in a non-standard
way.
Specifically, Janus/Ada has always had a predefined file name "KBD:" (or
"/dev/kbd" on Unix), which provides raw access to the keyboard device (or
standard input on more modern systems). This did not echo (or do any line
editing) on CP/M and MS-DOS, and we carried that same behavior over into
more modern systems.
For instance, the "Continue or Abort?" question in the compiler uses KBD: to
take and discard input immediately without any waiting (usual standard input
is line buffered and usually input is not processed until "enter" or similar
is pressed). It seemed to us that the Get_Immediate function was intending
the same sorts of uses. Note that implementing it this way makes it hard to
get meaningful results if Get_Immediate is mixed with other input on the
same file. (That's why we treated it as a special file in the beginning, but
even that gets confused if someone else reads from Standard_Input.)
Randy.
"Jeffrey R.Carter" <spam.jrcarter.not@spam.acm.org.not> writes:
> On 2023-10-02 04:42, richardthiebaud wrote:
>> with ada.text_io; use ada.text_io;
>> procedure test3 is
>> c: character;
>> avail: boolean;
>> begin
>> loop
>> loop
>> Get_Immediate(c, Avail);
>> if Avail then
>> exit;
>> end if;
>> delay 0.01;
>> end loop;
>> end loop;
>> end test3;
>
> I should have checked this earlier, but this does not echo with ObjectAda.
On what target system?
--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */
On 2023-10-04 22:39, Keith Thompson wrote: > Niklas Holsti <niklas.holsti@tidorum.invalid> writes: >> On 2023-10-04 11:22, Simon Wright wrote: >>> Keith Thompson <Keith.S.Thompson+u@gmail.com> writes: >>>> Simon Wright <simon@pushface.org> writes: >>>>> The low-level Get_Immediate implementation is in sysdep.c (probably >>>>> not in the adainclude/ directory in an installed compiler), in >>>>> getc_immediate() and getc_immediate_nowait(), both of which call >>>>> getc_immediate_common(), and I can't see any difference! ECHO gets >>>>> turned off in getc_immediate_common(), regardless of caller - see >>>>> link. >>>>> >>>>> https://github.com/gcc-mirror/gcc/blob/3ca09d684e496240a87c0327687e2898060c2363/gcc/ada/sysdep.c#L387 >>>> >>>> I haven't really looked into this, but I *think* what's happening is >>>> that for the versions with the Available parameter, ECHO hasn't yet been >>>> turned off when the user types the character. If you type 'x', it >>>> echoes immediately, because the program has no way of knowing that the >>>> character will later be consumed by a call to Get_Immediate. Presumably >>>> if the user hasn't typed anything, causing Available to be set to false, >>>> Get_Immediate will turn echoing off and back on again very quickly. >>>> Echoing is disabled only for small fraction of a second it takes for >>>> Get_Immediate to be executed. >>>> >>>> The Get_Immediate functions without the Available parameter block >>>> until a character is entered. They can disable echoing before the >>>> character is entered. Echoing will typically be disabled for minutes >>>> or seconds, from the time Get_Immediate is called and the time the >>>> user types something. >>>> >>>> The only solution I can think of would be to disable echoing (in some >>>> non-portable manner; I don't think the standard library provides this) >>>> before the user starts typing. (Perhaps you want to run the >>>> Get_Immediate without the Available parameter in a separate task?) >>> Great analysis! >> >> >> Yes indeed. >> >> A possible solution in Text_IO would be for Get_Immediate with >> Available not to enable echo when it exits. Get_Immediate with >> Available is typically called repeatedly, with no other input from the >> terminal in between these calls, so it should be ok to keep echo >> disabled from one such call to another. Any non-immediate input >> operation on the terminal (that is, on this Text_IO file) should start >> by re-enabling echo if it was disabled. Possibly the same should apply >> also to Get_Immediate without Available, that is, it should leave echo >> disabled, until some non-immediate input operation re-enables echo. > > The *first* character typed would still echo. Only if the user is quick enough to type it before the first call of Get_Immediate. If Get_Immediate is called for example to enter a password, usually the program will first prompt the user to "Enter password:" and then at once call Get_Immediate. Only a user who starts typing before the prompt is visible would have time to type something before the (first) call of Get_Immediate. > I suggest that what's needed is a way to turn echoing on and off. The user could still be quick enough to type characters before the echo is turned off, so they would echo. > Meanwhile, would calling Get_Immediate *without* the Available parameter > (which blocks and turns echoing off until after a character is typed) in > a separate task work? I haven't tried it. That should work, provided that the Ada run-time system does not block the whole program when one task blocks on an I/O request. There have been, and perhaps still are, Ada programming systems where the whole Ada program appears to the OS as a single OS thread so that one Ada task waiting on a blocking OS call blocks all other tasks in the program. > Of course you'd need to be careful not to have I/O calls from > separate tasks interfere with each other. Yes, but other tasks should be able to output text through Standard_Output even while one task is reading Standard_Input using a blocking I/O call. Except under a one-thread run-time system.
On 2023-10-02 04:42, richardthiebaud wrote:
>
> with ada.text_io; use ada.text_io;
> procedure test3 is
> c: character;
> avail: boolean;
> begin
> loop
> loop
> Get_Immediate(c, Avail);
> if Avail then
> exit;
> end if;
> delay 0.01;
> end loop;
> end loop;
> end test3;
I should have checked this earlier, but this does not echo with ObjectAda.
--
Jeff Carter
“[A]bout half the patterns in the 'Gang of Four'
book only exist because of defects in C++ ...”
Brian Drummond
174
Niklas Holsti <niklas.holsti@tidorum.invalid> writes:
> On 2023-10-04 11:22, Simon Wright wrote:
>> Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
>>> Simon Wright <simon@pushface.org> writes:
>>>> The low-level Get_Immediate implementation is in sysdep.c (probably
>>>> not in the adainclude/ directory in an installed compiler), in
>>>> getc_immediate() and getc_immediate_nowait(), both of which call
>>>> getc_immediate_common(), and I can't see any difference! ECHO gets
>>>> turned off in getc_immediate_common(), regardless of caller - see
>>>> link.
>>>>
>>>> https://github.com/gcc-mirror/gcc/blob/3ca09d684e496240a87c0327687e2898060c2363/gcc/ada/sysdep.c#L387
>>>
>>> I haven't really looked into this, but I *think* what's happening is
>>> that for the versions with the Available parameter, ECHO hasn't yet been
>>> turned off when the user types the character. If you type 'x', it
>>> echoes immediately, because the program has no way of knowing that the
>>> character will later be consumed by a call to Get_Immediate. Presumably
>>> if the user hasn't typed anything, causing Available to be set to false,
>>> Get_Immediate will turn echoing off and back on again very quickly.
>>> Echoing is disabled only for small fraction of a second it takes for
>>> Get_Immediate to be executed.
>>>
>>> The Get_Immediate functions without the Available parameter block
>>> until a character is entered. They can disable echoing before the
>>> character is entered. Echoing will typically be disabled for minutes
>>> or seconds, from the time Get_Immediate is called and the time the
>>> user types something.
>>>
>>> The only solution I can think of would be to disable echoing (in some
>>> non-portable manner; I don't think the standard library provides this)
>>> before the user starts typing. (Perhaps you want to run the
>>> Get_Immediate without the Available parameter in a separate task?)
>> Great analysis!
>
>
> Yes indeed.
>
> A possible solution in Text_IO would be for Get_Immediate with
> Available not to enable echo when it exits. Get_Immediate with
> Available is typically called repeatedly, with no other input from the
> terminal in between these calls, so it should be ok to keep echo
> disabled from one such call to another. Any non-immediate input
> operation on the terminal (that is, on this Text_IO file) should start
> by re-enabling echo if it was disabled. Possibly the same should apply
> also to Get_Immediate without Available, that is, it should leave echo
> disabled, until some non-immediate input operation re-enables echo.
The *first* character typed would still echo.
I suggest that what's needed is a way to turn echoing on and off.
Meanwhile, would calling Get_Immediate *without* the Available parameter
(which blocks and turns echoing off until after a character is typed) in
a separate task work? I haven't tried it. Of course you'd need to be
careful not to have I/O calls from separate tasks interfere with each
other.
--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */
On 2023-10-04 11:22, Simon Wright wrote:
> Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
>
>> Simon Wright <simon@pushface.org> writes:
>>> The low-level Get_Immediate implementation is in sysdep.c (probably
>>> not in the adainclude/ directory in an installed compiler), in
>>> getc_immediate() and getc_immediate_nowait(), both of which call
>>> getc_immediate_common(), and I can't see any difference! ECHO gets
>>> turned off in getc_immediate_common(), regardless of caller - see
>>> link.
>>>
>>> https://github.com/gcc-mirror/gcc/blob/3ca09d684e496240a87c0327687e2898060c2363/gcc/ada/sysdep.c#L387
>>
>> I haven't really looked into this, but I *think* what's happening is
>> that for the versions with the Available parameter, ECHO hasn't yet been
>> turned off when the user types the character. If you type 'x', it
>> echoes immediately, because the program has no way of knowing that the
>> character will later be consumed by a call to Get_Immediate. Presumably
>> if the user hasn't typed anything, causing Available to be set to false,
>> Get_Immediate will turn echoing off and back on again very quickly.
>> Echoing is disabled only for small fraction of a second it takes for
>> Get_Immediate to be executed.
>>
>> The Get_Immediate functions without the Available parameter block
>> until a character is entered. They can disable echoing before the
>> character is entered. Echoing will typically be disabled for minutes
>> or seconds, from the time Get_Immediate is called and the time the
>> user types something.
>>
>> The only solution I can think of would be to disable echoing (in some
>> non-portable manner; I don't think the standard library provides this)
>> before the user starts typing. (Perhaps you want to run the
>> Get_Immediate without the Available parameter in a separate task?)
>
> Great analysis!
Yes indeed.
A possible solution in Text_IO would be for Get_Immediate with Available
not to enable echo when it exits. Get_Immediate with Available is
typically called repeatedly, with no other input from the terminal in
between these calls, so it should be ok to keep echo disabled from one
such call to another. Any non-immediate input operation on the terminal
(that is, on this Text_IO file) should start by re-enabling echo if it
was disabled. Possibly the same should apply also to Get_Immediate
without Available, that is, it should leave echo disabled, until some
non-immediate input operation re-enables echo.
On 2023-10-04 13:38, Simon Wright wrote:
>
> Obviously you need to turn echoing off for password input. But neither
> the ARM nor the GNAT RM says anything about Get_Immediate's echoing
> behaviour, so it's hard to explain why OA does the same thing. Does its
> manual specify this behaviour?
Unfortunately, Ada does not provide a standard way to turn off echo.
I agree that the ARM says nothing about echo for any of its operations on
Standard_Input, but clearly there is a broad consensus of Ada.Text_IO writers
and users who think this is desirable behavior.
--
Jeff Carter
“[A]bout half the patterns in the 'Gang of Four'
book only exist because of defects in C++ ...”
Brian Drummond
174
Does anyone remember when Ada avionics S/W was first certified to DO-178? My memory is 1980s, but I haven’t been able to find any information about it. -- Jeff Carter “[A]bout half the patterns in the 'Gang of Four' book only exist because of defects in C++ ...” Brian Drummond 174
"Jeffrey R.Carter" <spam.jrcarter.not@spam.acm.org.not> writes:
> On 2023-10-04 10:22, Simon Wright wrote:
>> Or, alternatively, don't turn echoing off at all - what's the use
>> case
>> for turning it off? After all, the ARM says nothing about it.
>
> The use case is inputting passwords and the like. See Password_Line
> (https://github.com/jrcarter/Encryption-utilities/blob/master/password_line.ads)
> for an example. Note that this has identical behavior with GNAT/Linux
> and ObjectAda/Windows.
Obviously you need to turn echoing off for password input. But neither
the ARM nor the GNAT RM says anything about Get_Immediate's echoing
behaviour, so it's hard to explain why OA does the same thing. Does its
manual specify this behaviour?
On 2023-10-04 10:22, Simon Wright wrote: > > Or, alternatively, don't turn echoing off at all - what's the use case > for turning it off? After all, the ARM says nothing about it. The use case is inputting passwords and the like. See Password_Line (https://github.com/jrcarter/Encryption-utilities/blob/master/password_line.ads) for an example. Note that this has identical behavior with GNAT/Linux and ObjectAda/Windows. -- Jeff Carter “[A]bout half the patterns in the 'Gang of Four' book only exist because of defects in C++ ...” Brian Drummond 174
Hi Kenneth, Docker's main relevant use is to offer, at the price of a slight loss of performance (~15% max), a solid integration for a complex application including multiple linked programmes (e.g. a mail server). Docker's interface and standardization make it a pleasure to use. Docker is also a fast way of deploying a test environment and, in some cases, Docker is the best way to install an application. But today's followers sheep swear by micro-services¹, docker, k8s and other concepts that make applications huge, horribly complex and non-debuggable... ¹ Since many coders are unable to create more than a few hundred coherent lines, let's multiply these blocks of code into hundreds of micro-services, which communicate in a complex and inefficient way. So, docker is good, Alire is great, but these concepts don't solve everything. It could be an interesting experiment to link the two if there are complex program associations. For example, Docker and Ada could be combined to create a business application with an integrated MySQL or PostgreSQL DB. Even if the adoption of the very powerful SQLite would make it possible not to use Docker. We avoid using Docker in our multi-DC infrastructure based on Xen and Debian since we already handle Xen virtual instances. We also observed that a Docker instance was less reliable and secure than a virtualized Xen or KVM instance. We look forward to hearing about your experiences :) -- Stéphane Rivière Ile d'Oléron - France
Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
> Simon Wright <simon@pushface.org> writes:
>> The low-level Get_Immediate implementation is in sysdep.c (probably
>> not in the adainclude/ directory in an installed compiler), in
>> getc_immediate() and getc_immediate_nowait(), both of which call
>> getc_immediate_common(), and I can't see any difference! ECHO gets
>> turned off in getc_immediate_common(), regardless of caller - see
>> link.
>>
>> https://github.com/gcc-mirror/gcc/blob/3ca09d684e496240a87c0327687e2898060c2363/gcc/ada/sysdep.c#L387
>
> I haven't really looked into this, but I *think* what's happening is
> that for the versions with the Available parameter, ECHO hasn't yet been
> turned off when the user types the character. If you type 'x', it
> echoes immediately, because the program has no way of knowing that the
> character will later be consumed by a call to Get_Immediate. Presumably
> if the user hasn't typed anything, causing Available to be set to false,
> Get_Immediate will turn echoing off and back on again very quickly.
> Echoing is disabled only for small fraction of a second it takes for
> Get_Immediate to be executed.
>
> The Get_Immediate functions without the Available parameter block
> until a character is entered. They can disable echoing before the
> character is entered. Echoing will typically be disabled for minutes
> or seconds, from the time Get_Immediate is called and the time the
> user types something.
>
> The only solution I can think of would be to disable echoing (in some
> non-portable manner; I don't think the standard library provides this)
> before the user starts typing. (Perhaps you want to run the
> Get_Immediate without the Available parameter in a separate task?)
Great analysis! Is this worth raising a PR on GCC Bugzilla? (maybe only
on the documentation?)
Or, alternatively, don't turn echoing off at all - what's the use case
for turning it off? After all, the ARM says nothing about it.
Simon Wright <simon@pushface.org> writes:
> Niklas Holsti <niklas.holsti@tidorum.invalid> writes:
>> Possibly this is why AdaCore have given different echoing behaviors to
>> the two forms of Get_Immediate, with and without the "Available"
>> parameter. If so, this echo difference is unfortunately coupled with
>> the wait/no-wait behavior difference, and that coupling may be
>> unwanted.
>
> The low-level Get_Immediate implementation is in sysdep.c (probably not
> in the adainclude/ directory in an installed compiler), in
> getc_immediate() and getc_immediate_nowait(), both of which call
> getc_immediate_common(), and I can't see any difference! ECHO gets
> turned off in getc_immediate_common(), regardless of caller - see link.
>
> https://github.com/gcc-mirror/gcc/blob/3ca09d684e496240a87c0327687e2898060c2363/gcc/ada/sysdep.c#L387
I haven't really looked into this, but I *think* what's happening is
that for the versions with the Available parameter, ECHO hasn't yet been
turned off when the user types the character. If you type 'x', it
echoes immediately, because the program has no way of knowing that the
character will later be consumed by a call to Get_Immediate. Presumably
if the user hasn't typed anything, causing Available to be set to false,
Get_Immediate will turn echoing off and back on again very quickly.
Echoing is disabled only for small fraction of a second it takes for
Get_Immediate to be executed.
The Get_Immediate functions without the Available parameter block until
a character is entered. They can disable echoing before the character
is entered. Echoing will typically be disabled for minutes or seconds,
from the time Get_Immediate is called and the time the user types
something.
The only solution I can think of would be to disable echoing (in some
non-portable manner; I don't think the standard library provides this)
before the user starts typing. (Perhaps you want to run the
Get_Immediate without the Available parameter in a separate task?)
--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */
On Tuesday, October 3, 2023 at 2:44:56 PM UTC-7, Kenneth Wolcott wrote:
> Hi;
>
> Has anybody used a Docker container with Ada and Alire (obviously Linux)?
>
> If so,
>
> 1. did you create a Docker image using a Dockerfile?
>
> or
>
> 2. did you find a Docker base (eg: official Docker Ubuntu) image and modify it by downloading gnat source, compiling and installing it and then downloading Alire, compiling and installing it?
>
> or
>
> 3. Found an exiting Docker Linux image with all of the above all nicely preconfigured?
>
> If you used a Dockerfile, would you mind sharing it?
>
> I'm on a Mac with M1 chip and would like to consider getting Ada and Alire working in this manner as an alternative that *might* work more effectively than what I'm trying now.
>
> Thanks,
> Ken Wolcott
Update:
I chose the gcc linux/amd64 Docker Official Image (could have chosen Ubuntu, Fedora, Debian, Rocky, etc).
I downloaded the Linux Alire package and copied it over to the Docker container interactively running bash using the aforementioned Docker image.
I was able to get Alire to install the gnat native compiler for gcc13.
Now what remains is for me to re-learn how to use Docker and how to use Alire...like getting the Alire Docker container environment to be persistent...
Perhaps I will try a different official Docker image as a base to start with as I really don't need anything gcc related that Alire doesn't provide...
Perhaps I will try to create my own Dockerfile to create my own Docker image in which to run containers from.
I was hoping (still hoping) to get some sage advice from those here on any gotchas or suggestions to enhance the experience...
Thanks,
Ken
Hi; Has anybody used a Docker container with Ada and Alire (obviously Linux)? If so, 1. did you create a Docker image using a Dockerfile? or 2. did you find a Docker base (eg: official Docker Ubuntu) image and modify it by downloading gnat source, compiling and installing it and then downloading Alire, compiling and installing it? or 3. Found an exiting Docker Linux image with all of the above all nicely preconfigured? If you used a Dockerfile, would you mind sharing it? I'm on a Mac with M1 chip and would like to consider getting Ada and Alire working in this manner as an alternative that *might* work more effectively than what I'm trying now. Thanks, Ken Wolcott
On 02.10.23 04:42, richardthiebaud wrote:
> When I build and run the following program using Gnat 11 in Linux Mint 21.2, the keys I press are echoed on the console.
Which console?
Can you try to run a C program in the same console
that tests for it to be y TTY? See Simon Wright's link
to GNAT's implementation. The C program would be
calling isatty(0) or isatty(fileno(your_stream));
Some IDEs have a console window that is not
a TTY in the sense of termios(4)/tcsetattr(3).
Echoing is different, then.
Niklas Holsti <niklas.holsti@tidorum.invalid> writes: > Possibly this is why AdaCore have given different echoing behaviors to > the two forms of Get_Immediate, with and without the "Available" > parameter. If so, this echo difference is unfortunately coupled with > the wait/no-wait behavior difference, and that coupling may be > unwanted. The low-level Get_Immediate implementation is in sysdep.c (probably not in the adainclude/ directory in an installed compiler), in getc_immediate() and getc_immediate_nowait(), both of which call getc_immediate_common(), and I can't see any difference! ECHO gets turned off in getc_immediate_common(), regardless of caller - see link. https://github.com/gcc-mirror/gcc/blob/3ca09d684e496240a87c0327687e2898060c2363/gcc/ada/sysdep.c#L387
On 2023-10-03 1:47, richardthiebaud wrote: > On 10/2/23 18:27, Keith Thompson wrote: >> richardthiebaud <thiebauddick2@aol.com> writes: >>> On 10/2/23 01:48, Keith Thompson wrote: >>>> richardthiebaud <thiebauddick2@aol.com> writes: >>>>> When I build and run the following program using Gnat 11 in Linux Mint >>>>> 21.2, the keys I press are echoed on the console. According to the Ada >>>>> Reference Manual, they should not be echoed. Is this a compiler error? >>>> Where does the ARM say that? >>> https://www.adaic.org/resources/add_content/standards/05rm/html/RM-A-10-7.html >> >> I don't see anything there about the character being echoed, or not. Nor do I. But perhaps there should be something, since "not echoing" is useful behavior and the program can itself echo characters if that is desired. Possibly this is why AdaCore have given different echoing behaviors to the two forms of Get_Immediate, with and without the "Available" parameter. If so, this echo difference is unfortunately coupled with the wait/no-wait behavior difference, and that coupling may be unwanted. There are (or have been) computer terminals with local echo, where the program cannot prevent the display of each keystroke. So the "no echo" behavior cannot be an absolute requirement in the Ada manual, but it could be Implementation Advice. >>> If a character, either control or graphic, is available from the >>> specified File or the default input file, then the character is read; >>> Available is True and Item contains the value of this character. If a >>> character is not available, then Available is False and the value of >>> Item is not specified. Mode_Error is propagated if the mode of the file >>> is not In_File. End_Error is propagated if at the end of the file. The >>> current column, line and page numbers for the file are not affected. >> >> Are you assuming that not updating the current column, line, and page >> numbers for the file implies that the character is not echoed? >> >> [...] >> > In any case, when it echos the character. it increases the current > column by 1, and that does contradict the Ada Reference Manual. You are assuming that "current column" in the Ada Reference Manual means the same as the "current column position of the terminal/screen cursor", which is not the case, so there is no formal contradiction. The Ada "current column" refers to an internal state of the file. For an unknown type of terminal/screen, deducing the current cursor column from the stream of input characters and output characters is not feasible, because it depends on the device's interpretation of formatting control characters such as TABs and on the width of the screen or terminal window.
On 10/2/23 18:27, Keith Thompson wrote:
> richardthiebaud <thiebauddick2@aol.com> writes:
>> On 10/2/23 01:48, Keith Thompson wrote:
>>> richardthiebaud <thiebauddick2@aol.com> writes:
>>>> When I build and run the following program using Gnat 11 in Linux Mint
>>>> 21.2, the keys I press are echoed on the console. According to the Ada
>>>> Reference Manual, they should not be echoed. Is this a compiler error?
>>> Where does the ARM say that?
>> https://www.adaic.org/resources/add_content/standards/05rm/html/RM-A-10-7.html
>
> I don't see anything there about the character being echoed, or not.
>
>> If a character, either control or graphic, is available from the
>> specified File or the default input file, then the character is read;
>> Available is True and Item contains the value of this character. If a
>> character is not available, then Available is False and the value of
>> Item is not specified. Mode_Error is propagated if the mode of the file
>> is not In_File. End_Error is propagated if at the end of the file. The
>> current column, line and page numbers for the file are not affected.
>
> Are you assuming that not updating the current column, line, and page
> numbers for the file implies that the character is not echoed?
>
> [...]
>
In any case, when it echos the character. it increases the current
column by 1, and that does contradict the Ada Reference Manual.
On 10/2/23 18:27, Keith Thompson wrote:
> richardthiebaud <thiebauddick2@aol.com> writes:
>> On 10/2/23 01:48, Keith Thompson wrote:
>>> richardthiebaud <thiebauddick2@aol.com> writes:
>>>> When I build and run the following program using Gnat 11 in Linux Mint
>>>> 21.2, the keys I press are echoed on the console. According to the Ada
>>>> Reference Manual, they should not be echoed. Is this a compiler error?
>>> Where does the ARM say that?
>> https://www.adaic.org/resources/add_content/standards/05rm/html/RM-A-10-7.html
>
> I don't see anything there about the character being echoed, or not.
>
>> If a character, either control or graphic, is available from the
>> specified File or the default input file, then the character is read;
>> Available is True and Item contains the value of this character. If a
>> character is not available, then Available is False and the value of
>> Item is not specified. Mode_Error is propagated if the mode of the file
>> is not In_File. End_Error is propagated if at the end of the file. The
>> current column, line and page numbers for the file are not affected.
>
> Are you assuming that not updating the current column, line, and page
> numbers for the file implies that the character is not echoed?
>
> [...]
>
Yes.
richardthiebaud <thiebauddick2@aol.com> writes: > On 10/2/23 01:48, Keith Thompson wrote: >> richardthiebaud <thiebauddick2@aol.com> writes: >>> When I build and run the following program using Gnat 11 in Linux Mint >>> 21.2, the keys I press are echoed on the console. According to the Ada >>> Reference Manual, they should not be echoed. Is this a compiler error? >> Where does the ARM say that? > https://www.adaic.org/resources/add_content/standards/05rm/html/RM-A-10-7.html I don't see anything there about the character being echoed, or not. > If a character, either control or graphic, is available from the > specified File or the default input file, then the character is read; > Available is True and Item contains the value of this character. If a > character is not available, then Available is False and the value of > Item is not specified. Mode_Error is propagated if the mode of the file > is not In_File. End_Error is propagated if at the end of the file. The > current column, line and page numbers for the file are not affected. Are you assuming that not updating the current column, line, and page numbers for the file implies that the character is not echoed? [...] -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com Will write code for food. void Void(void) { Void(); } /* The recursive call of the void */
On 10/2/23 01:48, Keith Thompson wrote: > richardthiebaud <thiebauddick2@aol.com> writes: >> When I build and run the following program using Gnat 11 in Linux Mint >> 21.2, the keys I press are echoed on the console. According to the Ada >> Reference Manual, they should not be echoed. Is this a compiler error? > > Where does the ARM say that? https://www.adaic.org/resources/add_content/standards/05rm/html/RM-A-10-7.html > >> with ada.text_io; use ada.text_io; >> procedure test3 is >> c: character; >> avail: boolean; >> begin >> loop >> loop >> Get_Immediate(c, Avail); >> if Avail then >> exit; >> end if; >> delay 0.01; >> end loop; >> end loop; >> end test3; >> >> This does not happen if I call get_immediate without the avail >> parameter, i.e. get_immediate(c); >> >
On Thursday, September 21, 2023 at 12:37:02 PM UTC+4, Rod Kay wrote:
>
> Has anyone had any success using openGL in GtkAda ?
>
> I tried a quick test today and although the 'Gtk.GLArea' and
> 'Gdk.GLContext' packages are present, I was unable to get a GL context.
>
> Also, the testgtk program has no openGL demo, as it used to have.
>
> I used openGL/GtkAda to good effect many years ago. Has openGL
> support then been dropped completely ?
>
> I recall there was a Gtk3 bug related to openGL and thought that
> might possibly be the reason why it is absent in GtkAda. Does GtkAda use
> Gtk4, yet ?
>
> I'm quite keen to try my hand at game programming (and have
> developed an Ada game engine library), so any advice/info would be
> greatly appreciated.
>
Rod,
GtkAda is binding for Gtk+ 3.24.x version, it doesn't support Gtk 4.
GtkAda doesn't provide OpenGL API binding, but supports OpenGL. There is no example in testgtk for this reason - it requires OpenGL API binding.
richardthiebaud <thiebauddick2@aol.com> writes: > When I build and run the following program using Gnat 11 in Linux Mint > 21.2, the keys I press are echoed on the console. According to the Ada > Reference Manual, they should not be echoed. Is this a compiler error? Where does the ARM say that? > with ada.text_io; use ada.text_io; > procedure test3 is > c: character; > avail: boolean; > begin > loop > loop > Get_Immediate(c, Avail); > if Avail then > exit; > end if; > delay 0.01; > end loop; > end loop; > end test3; > > This does not happen if I call get_immediate without the avail > parameter, i.e. get_immediate(c); > -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com Will write code for food. void Void(void) { Void(); } /* The recursive call of the void */
When I build and run the following program using Gnat 11 in Linux Mint 21.2, the keys I press are echoed on the console. According to the Ada Reference Manual, they should not be echoed. Is this a compiler error? with ada.text_io; use ada.text_io; procedure test3 is c: character; avail: boolean; begin loop loop Get_Immediate(c, Avail); if Avail then exit; end if; delay 0.01; end loop; end loop; end test3; This does not happen if I call get_immediate without the avail parameter, i.e. get_immediate(c);
Kenneth Wolcott <kennethwolcott@gmail.com> writes:
> -macosx_version_min has been renamed to -macos_version_min
This will be fixed in GCC 14.
Hi Simon; > We're hoping that the 15.1 release of Command Line Tools fixes this. +1 > In the meantime, > > (1) using gnatmake, or gprbuild without changing the GPR: > > $ gnatmake foo.adb -largs -Wl,-ld_classic > or > $ gprbuild -P foo -largs -Wl,-ld_classic > > (2) modifying the GPR by adding a new package Linker: > > package Linker is > for Default_Switches ("ada") use ("-Wl,-ld_classic"); > end Linker; > > (3) if you already have a package Linker, modify as above. I chose option #1a... Using the Turtle Graphics Rosetta Code example for Ada, I was able to get a successful compile+link: gnatmake main.adb -largs -Wl,-ld_classic gcc -c main.adb gnatbind -x main.ali gnatlink main.ali -Wl,-ld_classic -macosx_version_min has been renamed to -macos_version_min Appreciate the suggestions... Thanks, Ken
The current version provides implementations of smart pointers, directed graphs, sets, maps, B-trees, stacks, tables, string editing, unbounded arrays, expression analyzers, lock-free data structures, synchronization primitives (events, race condition free pulse events, arrays of events, reentrant mutexes, deadlock-free arrays of mutexes), pseudo-random non-repeating numbers, symmetric encoding and decoding, IEEE 754 representations support, streams, persistent storage, multiple connections server/client designing tools and protocols implementations. The library is kept conform to the Ada 95, Ada 2005, Ada 2012 language standards. http://www.dmitry-kazakov.de/ada/components.htm Changes (30 September 2023) to the version 4.67: - Boolean types handling was added to the Python bindings; - Python library search path for OSX fixed. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
"hn...@yahoo.de" <hnptz@yahoo.de> writes: > What exactly is meant by "Using GNAT 12.2.0"? I put gcc-13.2.0 in ~/.zshrc. > Then I got Could not locate executable on path: gprbuild. > What do i miss? First, I asked above where you got GCC 13.2.0 from; you certainly didn't get it from one of my builds. If you got it via Homebrew, then be aware that homebrew's gcc *does* *not* *support* *Ada* (or gprbuild). There are two ways I know of for getting hold of GNAT and gprbuild: (1) go to https://alire.ada.dev/docs/#introduction and follow the steps at 'alr for macOS', then 'First steps' ... This provides GCC 12.2.0 for x86_64 (intel), which runs on an M1/M2 mac under Rosetta. (2) go to my release page at https://github.com/simonjwright/distributing-gcc/releases and download for Intel: https://github.com/simonjwright/distributing-gcc/releases/tag/gcc-13.1.0-x86_64 for M1/M2: https://github.com/simonjwright/distributing-gcc/releases/tag/gcc-13.1.0-aarch64-2 (in both cases, the actual download is found under Assets at the bottom of the page; but please read the release notes for what's included and how to install).
Kenneth Wolcott <kennethwolcott@gmail.com> writes: >> > It turns out there's an environment variable DEFAULT_LINKER, which with > > I tried this (xport > DEFAULT_LINKER=/Library/Developer/CommandLineTools/usr/bin/ld-classic) > and it did not help: As I said above, this only affects building GCC, not using it. Sorry. > Are there any other workarounds to solve the inability to link? This > does not only adversely affect Ada, but everything that uses a linker, > BTW. I have some evidence that the issue only arises with static libraries. Not much help. We're hoping that the 15.1 release of Command Line Tools fixes this. In the meantime, (1) using gnatmake, or gprbuild without changing the GPR: $ gnatmake foo.adb -largs -Wl,-ld_classic or $ gprbuild -P foo -largs -Wl,-ld_classic (2) modifying the GPR by adding a new package Linker: package Linker is for Default_Switches ("ada") use ("-Wl,-ld_classic"); end Linker; (3) if you already have a package Linker, modify as above.
Hi Simon; >I'd recommend taking a copy of /Library/Developer/CommandLineTools > before updating to 15.0. Well, I should have done this, but I didn't... > > It turns out there's an environment variable DEFAULT_LINKER, which with I tried this (xport DEFAULT_LINKER=/Library/Developer/CommandLineTools/usr/bin/ld-classic) and it did not help: Using: /opt/gcc-13.1.0-aarch64/bin/gnatmake --version GNATMAKE 13.1.0 -- This is from Rosetta Code: with Ada.Text_IO; use Ada.Text_IO; procedure Test_Short_Circuit is function A (Value : Boolean) return Boolean is begin Put (" A=" & Boolean'Image (Value)); return Value; end A; function B (Value : Boolean) return Boolean is begin Put (" B=" & Boolean'Image (Value)); return Value; end B; begin for I in Boolean'Range loop for J in Boolean'Range loop Put (" (A and then B)=" & Boolean'Image (A (I) and then B (J))); New_Line; end loop; end loop; for I in Boolean'Range loop for J in Boolean'Range loop Put (" (A or else B)=" & Boolean'Image (A (I) or else B (J))); New_Line; end loop; end loop; end Test_Short_Circuit; gnatmake test_short_circuit.adb gcc -c test_short_circuit.adb gnatbind -x test_short_circuit.ali gnatlink test_short_circuit.ali -macosx_version_min has been renamed to -macos_version_min ld: warning: ignoring duplicate libraries: '-lgcc' 0 0x10306b648 __assert_rtn + 72 1 0x102f9ffac ld::AtomPlacement::findAtom(unsigned char, unsigned long long, ld::AtomPlacement::AtomLoc const*&, long long&) const + 1204 2 0x102fb5924 ld::InputFiles::SliceParser::parseObjectFile(mach_o::Header const*) const + 15164 3 0x102fc304c ld::InputFiles::parseAllFiles(void (ld::AtomFile const*) block_pointer)::$_7::operator()(unsigned long, ld::FileInfo const&) const + 960 4 0x18e36d950 _dispatch_client_callout2 + 20 5 0x18e3821a4 _dispatch_apply_invoke_and_wait + 176 6 0x18e381464 _dispatch_apply_with_attr_f + 1176 7 0x18e381650 dispatch_apply + 96 8 0x10303d3b8 ld::AtomFileConsolidator::parseFiles(bool) + 292 9 0x102fde170 main + 9048 ld: Assertion failed: (resultIndex < sectData.atoms.size()), function findAtom, file Relocations.cpp, line 1336. collect2: error: ld returned 1 exit status gnatlink: error when calling /opt/gcc-13.1.0-aarch64/bin/gcc gnatmake: *** link failed. Are there any other workarounds to solve the inability to link? This does not only adversely affect Ada, but everything that uses a linker, BTW. Thanks, Ken Wolcott
On 29/09/2023 21:26, hn...@yahoo.de wrote:
> On Thursday, September 28, 2023 at 11:00:33 PM UTC+2, Simon Wright wrote:
>> Simon Wright <si...@pushface.org> writes:
>>
>>> moi <findl...@blueyonder.co.uk> writes:
>>>
>>>> I installed 14.0, Sonoma, on my M1 Mac last night.
>>>>
>>>> The good news:
>>>>
>>>> Using GNAT 12.2.0, it all just works, *so long as* I REMOVE
>>>> '-largs -Wl,-ld_classic' from the linker options!
>>>
>>> Likewise, but that didn't work for me.
>> You can't reinstall the 14.3 CLT under Sonoma (it's "too old"). I
>> reinstalled from a Time Machine backup, but if you don't have that set
>> up I'd recommend taking a copy of /Library/Developer/CommandLineTools
>> before updating to 15.0.
>>> It turns out there's an environment variable DEFAULT_LINKER, which with
>> [...]
>>> I haven't tried this.
>> This affects building the compiler, not using it.
>
> What exactly is meant by "Using GNAT 12.2.0"? I put gcc-13.2.0 in ~/.zshrc.
> Then I got Could not locate executable on path: gprbuild.
> What do i miss?
It means using the version that announces itself
at the head of the source listing as:
"GNAT 12.2.0
Copyright 1992-2022, Free Software Foundation, Inc."
What exactly is meant by "I put gcc-13.2.0 in ~/.zshrc"?
--
Bill F.
On Thursday, September 28, 2023 at 11:00:33 PM UTC+2, Simon Wright wrote:
> Simon Wright <si...@pushface.org> writes:
>
> > moi <findl...@blueyonder.co.uk> writes:
> >
> >> I installed 14.0, Sonoma, on my M1 Mac last night.
> >>
> >> The good news:
> >>
> >> Using GNAT 12.2.0, it all just works, *so long as* I REMOVE
> >> '-largs -Wl,-ld_classic' from the linker options!
> >
> > Likewise, but that didn't work for me.
> You can't reinstall the 14.3 CLT under Sonoma (it's "too old"). I
> reinstalled from a Time Machine backup, but if you don't have that set
> up I'd recommend taking a copy of /Library/Developer/CommandLineTools
> before updating to 15.0.
> > It turns out there's an environment variable DEFAULT_LINKER, which with
> [...]
> > I haven't tried this.
> This affects building the compiler, not using it.
What exactly is meant by "Using GNAT 12.2.0"? I put gcc-13.2.0 in ~/.zshrc.
Then I got Could not locate executable on path: gprbuild.
What do i miss?
On Thursday, September 28, 2023 at 11:00:33 PM UTC+2, Simon Wright wrote:
> Simon Wright <si...@pushface.org> writes:
>
> > moi <findl...@blueyonder.co.uk> writes:
> >
> >> I installed 14.0, Sonoma, on my M1 Mac last night.
> >>
> >> The good news:
> >>
> >> Using GNAT 12.2.0, it all just works, *so long as* I REMOVE
> >> '-largs -Wl,-ld_classic' from the linker options!
> >
> > Likewise, but that didn't work for me.
> You can't reinstall the 14.3 CLT under Sonoma (it's "too old"). I
> reinstalled from a Time Machine backup, but if you don't have that set
> up I'd recommend taking a copy of /Library/Developer/CommandLineTools
> before updating to 15.0.
> > It turns out there's an environment variable DEFAULT_LINKER, which with
> [...]
> > I haven't tried this.
> This affects building the compiler, not using it.
On Wednesday, June 7, 2023 at 9:55:55 PM UTC-6, Nasser M. Abbasi wrote:
> Some folks in this thread
>
> https://discourse.julialang.org/t/comparison-of-rust-to-julia-for-scientific-computing/78508
>
> "I’m not an expert, but my feeling is that Rust is a “safer” language,
> which to me means it must be slower."
>
> etc..
>
> Some in that thread seem to argue that a safer language
> will/could be slower than otherwise.
>
> Since Ada is known to be one of the safest languages,
> do others here feel there is any truth to this?
>
> I thought that by having more type information in the language,
> the compile will be able to make more optimizations (because it
> know more), and hence the generated code should actually be
> faster, not slower with a language that is less safe?
>
> I am not a compiler expert but what do others here think?
>
> --Nasser
An interesting proposition fueled by two differing intuitions: one, saying that mandatory checks must necessarily slow things down, and the other saying that having more information allows for greater optimization.
We can, of course, walk through a few simple/trivial examples to flesh out which intuition is more correct.
FIRST, let's consider Array-access in Ada, which mandates a check on the index:
Subtype Real is Float range Float'Range; -- Removing NaN, INF, etc.
Type Real_Vector is array (Positive range <>) of Real;
Function Normalize(Input : in Real_Vector) return Real_Vector is
Function Maximum return Real is
Begin
-- Start w/ Negative-most number; geturn the maximum.
Return Result : Real:= Real'First do
For Index in Input'Range loop
Result:= Real'Max(Result, Input(Index));
end loop;
End return;
End Maximum;
Begin
case Input'Length is
when 0 => Return Input;
when 1 => Return (1 => 1.0);
when others =>
Return Result : Real_Vector(Input'Range) do
declare
Max : Real renames Maximum;
begin
For Index in Result'Range loop
Result(Index):= Input(Index) / Max;
End loop;
end;
End return;
end case;
End Normalize;
In the above, we see the control of the For-loop, "Index", which takes its values from the input (directly or indirectly), and therefore the indexing of Input(Index) *cannot* be outside the bounds of the array, Input. This means that we can omit the checks altogether as Index is bound to the constraints of the array. And we can deduce this directly from the source, at compile-time, therefore allowing us to remove the checks altogether.
SECOND, consider:
Type Window is tagged private;
Type Window_Pointer is access all Window'Class;
Subtype Window_Handle is not null Window_Pointer;
Procedure Set_Title( Object : Window_Handle; Text : String );
In the above, we see that Object is an access to Window'Class which excludes Null -- since this constraint is enforced to the parameter on-call, in the body the compiler can assume that "Object /= Null" is true.
THIRD, similar to the second:
Type Safe_Text is String
with Dynamic_Predicate => (for all Ch of Safe_Text => Ch in 'a'..'z'|'A'..'Z'|' '||'0'..'9');
Function Transform( Input : Safe_Text ) return Safe_Text;
X : Safe_Text := Transform(Transform(Transform(Transform( Whatever ))));
in the above, we note that the parameter is checked for conformance, raising exception CONSTRAINT_ERROR if it fails, and is guaranteed to either return a Safe_Text value or else raise an exception -- applying these, we can eliminate all the checks for the parameter except the innermost, thus optimizing in a way that you cannot if your input and output types were more broad.
So, the intuition that "more information provides more optimization opportunity" is the correct one.
Le 29/09/2023 à 12:42, Chris Townley a écrit :
> On 29/09/2023 10:59, Kevin Chadwick wrote:
>>
>>>>>> Tasking is very limited. For example you can't use
>>>>>> timeouts. Never. They propose a workaround but it is complex and not
>>>>>> equivalent to a real timeout management.
>>>>>
>>>>> Not sure what a "real timeout management" would look like?
>>>>>
>>>>>> I'd like to have a full Ada RTS for embedded targets, like on
>>>>>> desktop.
>>>>>
>>>>> Have you considered using something like a Raspberry Pi?
>>>> A RaspberryPi is a computer (based on a microprocessor with an OS),
>>>> not an micro-controller. It consumes a lot of electrical power. The
>>>> OS (linux) is not real time. It uses a lot of board space. The
>>>> processor is a proprietary black box...
>>>>
>>>
>>> Plenty use the Raspberry Pi as a microcontroller
>>
>> I think Simons point was that Arm/Linux has a working full runtime. I
>> guess
>> bare raspberry pie would not and I guess it would be a rather large
>> module
>> or board or single board computer depending on the model.
>>
>> WRT energy use. I use a low power run feature on the STM32L4 which
>> means the
>> system clock speed can change at any time. That seems to be incompatible
>> with any runtime that I have seen except the minimal light-cortex-m4
>> one. I
>> assume working with clocks is more scalable than working with runtimes
>> but
>> I do not know for sure.
>>
>
> Agreed, but in addition to the mainline Pis there is the zero, and the
> pico, which has a 'RP2040' made by Raspberry Pi and is a dual-core ARM
> Cortex M0+ processor, with a flexible clock running up to 133MHz
>
A runtime for the RP2040 already exist. It is based on the Adacore ARM
runtimes so has the same limitations.
> WRT energy use. I use a low power run feature on the STM32L4 which means
> the
> system clock speed can change at any time. That seems to be incompatible
> with any runtime that I have seen except the minimal light-cortex-m4 one. I
> assume working with clocks is more scalable than working with runtimes but
> I do not know for sure.
>
The fact that the clock speed is hard coded is a design choice.
It simplifies the time management.
It makes the runtime more "hard real time" compliant since there are
less computations to be done at execution.
On 29/09/2023 10:59, Kevin Chadwick wrote:
>
>>>>> Tasking is very limited. For example you can't use
>>>>> timeouts. Never. They propose a workaround but it is complex and not
>>>>> equivalent to a real timeout management.
>>>>
>>>> Not sure what a "real timeout management" would look like?
>>>>
>>>>> I'd like to have a full Ada RTS for embedded targets, like on
>>>>> desktop.
>>>>
>>>> Have you considered using something like a Raspberry Pi?
>>> A RaspberryPi is a computer (based on a microprocessor with an OS),
>>> not an micro-controller. It consumes a lot of electrical power. The
>>> OS (linux) is not real time. It uses a lot of board space. The
>>> processor is a proprietary black box...
>>>
>>
>> Plenty use the Raspberry Pi as a microcontroller
>
> I think Simons point was that Arm/Linux has a working full runtime. I guess
> bare raspberry pie would not and I guess it would be a rather large module
> or board or single board computer depending on the model.
>
> WRT energy use. I use a low power run feature on the STM32L4 which means
> the
> system clock speed can change at any time. That seems to be incompatible
> with any runtime that I have seen except the minimal light-cortex-m4 one. I
> assume working with clocks is more scalable than working with runtimes but
> I do not know for sure.
>
Agreed, but in addition to the mainline Pis there is the zero, and the
pico, which has a 'RP2040' made by Raspberry Pi and is a dual-core ARM
Cortex M0+ processor, with a flexible clock running up to 133MHz
--
Chris
\r>>>> Tasking is very limited. For example you can't use
>>>> timeouts. Never. They propose a workaround but it is complex and not
>>>> equivalent to a real timeout management.
>>>
>>> Not sure what a "real timeout management" would look like?
>>>
>>>> I'd like to have a full Ada RTS for embedded targets, like on
>>>> desktop.
>>>
>>> Have you considered using something like a Raspberry Pi?
>> A RaspberryPi is a computer (based on a microprocessor with an OS), not
>> an micro-controller. It consumes a lot of electrical power. The OS
>> (linux) is not real time. It uses a lot of board space. The processor is
>> a proprietary black box...
>>
>
>Plenty use the Raspberry Pi as a microcontroller
I think Simons point was that Arm/Linux has a working full runtime. I guess
bare raspberry pie would not and I guess it would be a rather large module
or board or single board computer depending on the model.
WRT energy use. I use a low power run feature on the STM32L4 which means the
system clock speed can change at any time. That seems to be incompatible
with any runtime that I have seen except the minimal light-cortex-m4 one. I
assume working with clocks is more scalable than working with runtimes but
I do not know for sure.
--
Regards, Kc
On 28/09/2023 22:18, DrPi wrote:
> Le 28/09/2023 à 22:53, Simon Wright a écrit :
>> DrPi <314@drpi.fr> writes:
>>
>>> Tasking is very limited. For example you can't use
>>> timeouts. Never. They propose a workaround but it is complex and not
>>> equivalent to a real timeout management.
>>
>> Not sure what a "real timeout management" would look like?
>>
>>> I'd like to have a full Ada RTS for embedded targets, like on
>>> desktop.
>>
>> Have you considered using something like a Raspberry Pi?
> A RaspberryPi is a computer (based on a microprocessor with an OS), not
> an micro-controller. It consumes a lot of electrical power. The OS
> (linux) is not real time. It uses a lot of board space. The processor is
> a proprietary black box...
>
Plenty use the Raspberry Pi as a microcontroller
--
Chris
Le 28/09/2023 à 22:53, Simon Wright a écrit :
> DrPi <314@drpi.fr> writes:
>
>> Tasking is very limited. For example you can't use
>> timeouts. Never. They propose a workaround but it is complex and not
>> equivalent to a real timeout management.
>
> Not sure what a "real timeout management" would look like?
>
>> I'd like to have a full Ada RTS for embedded targets, like on
>> desktop.
>
> Have you considered using something like a Raspberry Pi?
A RaspberryPi is a computer (based on a microprocessor with an OS), not
an micro-controller. It consumes a lot of electrical power. The OS
(linux) is not real time. It uses a lot of board space. The processor is
a proprietary black box...
Simon Wright <simon@pushface.org> writes: > moi <findlaybill@blueyonder.co.uk> writes: > >> I installed 14.0, Sonoma, on my M1 Mac last night. >> >> The good news: >> >> Using GNAT 12.2.0, it all just works, *so long as* I REMOVE >> '-largs -Wl,-ld_classic' from the linker options! > > Likewise, but that didn't work for me. You can't reinstall the 14.3 CLT under Sonoma (it's "too old"). I reinstalled from a Time Machine backup, but if you don't have that set up I'd recommend taking a copy of /Library/Developer/CommandLineTools before updating to 15.0. > It turns out there's an environment variable DEFAULT_LINKER, which with [...] > I haven't tried this. This affects building the compiler, not using it.
DrPi <314@drpi.fr> writes: > Tasking is very limited. For example you can't use > timeouts. Never. They propose a workaround but it is complex and not > equivalent to a real timeout management. Not sure what a "real timeout management" would look like? > I'd like to have a full Ada RTS for embedded targets, like on > desktop. Have you considered using something like a Raspberry Pi?
> The current implementation has about 17 files (1 .h, 1 .s, 9 .ads, 4
> .adb) to customise to the chip (setting up interrupt vectors, the clock,
> and memory). There are about 200 Ada sources that are common.
>
> AdaCore currently have 68 RTS packages in the Alire gnat_arm_elf
> toolchain. 18 of these are 'embedded' packages (full Ada, but with
> Jorvik tasking). I'd be surprised if they had a higher proportion of
> chip dependency than my efforts. Most if not all of the exception
> handling will be chip-independent. I'm not sure how many of the 90 or so
> Ada sources in the STM32F4 gnarl/ directory are actually chip-dependent,
> I get the impression it's not high.
>
Right, not high.
I've created 2 of them based on one of the Adacore RTS.
I can't say it has been easy since you first have to understand how it
works (and things change at each new release).
One important point is that some critical parameters are hard coded in
the source code. Like the core frequency. You MUST use a fix clock
frequency to get correct time management (delays, ...). This is why in
their last version, you run a script to generate part of the RTS source
code (frequency and other parameters are injected in the source code).
When you change the core frequency you have to regenerate the RTS binary.
I created the RTS to evaluate the potential use of Ada on embedded
targets. I have never used them except for testing.
The main reason is that Adacore RTS are made for specific use (avionics,
spatial...). The code using these RTS must be provable (or as provable
as possible). This induce big limitations.
Tasking is very limited. For example you can't use timeouts. Never. They
propose a workaround but it is complex and not equivalent to a real
timeout management.
I'd like to have a full Ada RTS for embedded targets, like on desktop. I
don't need to certify/prove my hardware/software.
Some people say micro-controllers are too limited for this. That's true
for some of them. I use micro-controllers with megabytes FLASH memory
and hundreds kilobytes of RAM. Is this not enough ?
moi <findlaybill@blueyonder.co.uk> writes:
> I installed 14.0, Sonoma, on my M1 Mac last night.
>
> The good news:
>
> Using GNAT 12.2.0, it all just works, *so long as* I REMOVE
> '-largs -Wl,-ld_classic' from the linker options!
Likewise, but that didn't work for me.
It turns out there's an environment variable DEFAULT_LINKER, which with
the 15.0 CLT would be set to
export DEFAULT_LINKER=/Library/Developer/CommandLineTools/usr/bin/ld-classic
(the Xcode equivalent is much longer & more inscrutable)
I haven't tried this.
Kevin Chadwick <kc-usenet@chadwicks.me.uk> writes: > That buffer support is pretty neat but my main concern which Gnat may > (it may not) address more than the current language by providing a > cortex runtime. Is that such demanding runtimes are brilliant but I am > not sure if even Ravenscar is scalable to so many microchips such as > Rust is trying to support. That isn't a huge issue but barriers to > entry like having to work out your own exception replacement might be > turning users away. Which is unfortunate when Ada is the best language > out there by a significant margin for embedded development or frankly > any protocol or hardware register use. When I started on Cortex GNAT RTS[1], a large part of the motivation (aside from the fun element) was that AdaCore's bare-board RTSs were GPL'd (they still are). Not that I cared about that, but other people did. I took the approach of AdaCore's SFP (small footprint) profile, now renamed to light tasking, which implemented Ravenscar tasking but not exception propagation or finalization. The tasking part wasn't too hard, though I think exception handling and finalization might have made things more difficult. Basing the tasking on FreeRTOS saved a lot of grief (there are a couple of areas when the resulting semantic isn't _quite_ Ada's). I did some work on finalization, not merged. Exception handling, without finalization, seemed a daunting prospect, specially since the last project I worked on before retirement regarded an unhandled exception as requiring a reboot (and ditching any missiles in flight). The current implementation has about 17 files (1 .h, 1 .s, 9 .ads, 4 .adb) to customise to the chip (setting up interrupt vectors, the clock, and memory). There are about 200 Ada sources that are common. AdaCore currently have 68 RTS packages in the Alire gnat_arm_elf toolchain. 18 of these are 'embedded' packages (full Ada, but with Jorvik tasking). I'd be surprised if they had a higher proportion of chip dependency than my efforts. Most if not all of the exception handling will be chip-independent. I'm not sure how many of the 90 or so Ada sources in the STM32F4 gnarl/ directory are actually chip-dependent, I get the impression it's not high. -------------------- So, unless you're going to use some target that AdaCore haven't released support for, your best bet must be to either use or at worst start from the available RTS packages. [1] https://github.com/simonjwright/cortex-gnat-rts
>Bounded Text_Buffer instead. So the language addresses this particular >concern. > >I don't know if GNAT implements all of those ways (in particular, the >restriction Max_Image_Length), but that is hardly the fault of the language! I see. I guess the error message could suggest those options, too. Perhaps after the 2022 Gnat support work is completed. That buffer support is pretty neat but my main concern which Gnat may (it may not) address more than the current language by providing a cortex runtime. Is that such demanding runtimes are brilliant but I am not sure if even Ravenscar is scalable to so many microchips such as Rust is trying to support. That isn't a huge issue but barriers to entry like having to work out your own exception replacement might be turning users away. Which is unfortunate when Ada is the best language out there by a significant margin for embedded development or frankly any protocol or hardware register use. Of course others will rightly argue Ada is the best due to many of the more complex runtime features but that doesn't help with the issue of ease of adoption on an unsupported microchip that I have raised above. > >For anyone else interested in this particular discussion, I recommend >reading and following up on the ARG Githib issue rather than here >(https://github.com/Ada-Rapporteur-Group/User-Community-Input/issues/67). >
The federal government has issued an RFI (Request For Information) on the topic of increasing software security. 10-page max (excluding cover-page and appendix, if any). Request for Information on Open-Source Software Security: Areas of Long-Term Focus and Prioritization https://www.federalregister.gov/documents/2023/08/10/2023-17239/request-for-information-on-open-source-software-security-areas-of-long-term-focus-and-prioritization
As noted on the ARG Github, you confused the Unbounded version of Text_Buffers with an unbounded string (completely unrelated things), and moreover, failed to notice that the language provides multiple ways to use a Bounded Text_Buffer instead. So the language addresses this particular concern. I don't know if GNAT implements all of those ways (in particular, the restriction Max_Image_Length), but that is hardly the fault of the language! For anyone else interested in this particular discussion, I recommend reading and following up on the ARG Githib issue rather than here (https://github.com/Ada-Rapporteur-Group/User-Community-Input/issues/67). Randy. "Kevin Chadwick" <kc-usenet@chadwicks.me.uk> wrote in message news:ueug62$2fvor$1@dont-email.me... >I created the issue below a little while ago. Today I wonder whether Ada > 2022s 'Image attribute on records use of Unbounded strings is for good > reason. Is it an oversight that Bounded String would work with the new > light runtime or String with all runtimes including the older zero > footprint runtimes? > > Perhaps it was decided that a light runtime would not use this feature? > and > I can cerrainly avoid it. However I use a light runtime with 100s of > kilobytes or ram and many gigabytes of flash. > > Ada is a much nicer language than Rust which uses unsafe all over for > embedded but one thing that is interesting is that I believe all Rust code > can be run easily on any target. Should Ada aspire to that? > > On the other hand micros are becoming multiprocessor bringing more demand > for tasking (protected types are not compatible with a light runtime) but > personally I believe multi chip single core designs are far better than > multicore and not only due to the impossibility of side channel attacks > like spectre. > > https://github.com/Ada-Rapporteur-Group/User-Community-Input/issues/67 > > -- > Regards, Kc
No, the specified representation is always used when storing to memory (with
the single exception of loop parameters, which cannot have address clauses
or other representation specifications). I think even enum parameters are
written in the representation. However, any time an enumeration value is
read into a register it is converted to a position number. Usually, such
values are used in indexing, comparing, or an attribute like 'Pos or 'Succ,
all of which are defined to work on position numbers. But if you simply
assign the value out again, it will get converted both ways. We do have an
optimization to remove pairs of TOREP/DEREP, but not the reverse since
Program_Error is a possibility from DEREP. (Well, unless unsafe
optimizations are on, but I don't recommend using those for the obvious
reasons.)
Randy.
"Niklas Holsti" <niklas.holsti@tidorum.invalid> wrote in message
news:knff56Fdjg6U1@mid.individual.net...
> On 2023-09-26 9:13, Randy Brukardt wrote:
>
>> ... for Janus/Ada, enumeration types with specified representations
>> operate internally on the position numbers
>
>
> Hm, that's interesting. Is that also the representation for record
> components of such an enumerated type?
>
> For example, if I have:
>
> type Command is (Off, On) with Size => 4;
> for Command use (Off => 2, On => 5);
> type Two_Commands is record
> C1, C2: Command;
> end record
> with Pack, Size => 8;
>
> TwoC : Two_Commands := (C1 => On, C2 => Off);
>
> will the record components (in memory) have the values C1 = 1 and C2 = 0
> (position numbers) or C1 = 5, C2 = 2 (specified representation)?
>
> If they are represented by position numbers in the record, many if not
> most of my embedded Ada programs would fail if compiled with Janus/Ada,
> because the record values stored in I/O control registers or accessed via
> DMA would be wrong.
>
> Damn, I thought those programs were not so compiler-dependent :-(
>
I installed 14.0, Sonoma, on my M1 Mac last night. The good news: Using GNAT 12.2.0, it all just works, *so long as* I REMOVE '-largs -Wl,-ld_classic' from the linker options! -- Bill F.
Le 27/09/2023 à 01:32, richardthiebaud a écrit : > I have a bug with gnatpp which prevents is starting. Where should I > report this? I tried to report it on Gnu's bug system but they said it > is not their program. Hello, GNATPP is part of LibAdaLang Tools available on GitHub: https://github.com/AdaCore/libadalang-tools Post your issue there: https://github.com/AdaCore/libadalang-tools/issues HTH, Pascal.
On 27.09.23 01:32, richardthiebaud wrote:
> I have a bug with gnatpp which prevents is starting. Where should I report this? I tried to report it on Gnu's bug system but they said it is not their program.
When I invoke mine with option --help, then the last line
it outputs has this:
Report bugs to...
$
I have a bug with gnatpp which prevents is starting. Where should I report this? I tried to report it on Gnu's bug system but they said it is not their program.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain, Size: 5945 bytes --] ----------------------------------------------------------------------- First Call for Contributions 28th Ada-Europe International Conference on Reliable Software Technologies (AEiC 2024) 11-14 June 2024, Barcelona, Spain www.ada-europe.org/conference2024 *** Journal-track submissions by 15 January 2024 *** *** Other submissions by 26 February 2024 *** Organized by Ada-Europe in cooperation with the Barcelona Supercomputing Center #AEiC2024 #AdaEurope #AdaProgramming ----------------------------------------------------------------------- *** General Information The 28th Ada-Europe International Conference on Reliable Software Technologies (AEiC 2024) will take place in Barcelona, Spain. The conference schedule comprises a journal track, an industrial track, a work-in-progress track, a vendor exhibition, parallel tutorials, and satellite workshops. - Journal-track papers present research advances supported by solid theoretical foundation and thorough evaluation. - Industrial-track contributions highlight the practitioners' side of a challenging case study or industrial project. - The work-in-progress-track illustrates novel research ideas that are still at an initial stage, between conception and first prototype. - Tutorials guide attenders through a hands-on familiarization with innovative developments or with useful features related to reliable software. - Workshops provide discussion forums on themes related to the conference topics. *** Schedule 15 January 2024: Deadline for submission of journal-track papers 26 February 2024: Deadline for submission of industrial-track papers, work-in-progress papers, tutorial and workshop proposals 22 March 2024: First round notification for journal-track papers, and notification of acceptance for all other types of submissions 11-14 June 2024: Conference *** Scope and Topics The conference is a leading international forum for providers, practitioners, and researchers in reliable software technologies. The conference presentations will illustrate current work in the theory and practice of the design, development, and maintenance of long-lived, high-quality software systems for a challenging variety of application domains. The program will allow ample time for keynotes, Q&A sessions and discussions, and social events. Participants include practitioners and researchers from industry, academia, and government organizations active in the promotion and development of reliable software technologies. The topics of interest for the conference include but are not limited to: - Formal and Model-Based Engineering of Critical Systems; - High-Integrity Systems and Reliability; - AI for High-Integrity Systems Engineering; - Real-Time Systems; - Ada Language; - Applications in relevant domains. More specific topics are described on the conference web page, at www.adaeurope.org/conference2024. *** Call for Submissions Details per track will follow shortly. *** Organizing Committee - Conference Chair Sara Royuela, Barcelona Supercomputing Center, Spain sara.royuela at bsc.es - Journal-track Chairs Bjorn Andersson, Carnegie Mellon University, USA baandersson at sei.cmu.edu Luis Miguel Pinho, ISEP & INESC TEC, Portugal lmp at isep.ipp.pt - Industrial-track Chairs Luciana Provenzano, Mälardalen University, Sweden luciana.provenzano at mdu.se Michael Pressler, Bosch, Germany Michael.Pressler at de.bosch.com - Work-In-Progress-track Chairs Alejandro R. Mosteo, CUD Zaragoza, Spain amosteo at unizar.es Ruben Martins, Carnegie Mellon University, USA rubenm at andrew.cmu.edu - Tutorial Chair Maria A. Serrano, NearbyComputing, Spain maria.serrano at nearbycomputing.com - Workshop Chair Sergio Saez, Universitat Politècnica de València, Spain ssaez at disca.upv.es - Exhibition & Sponsorship Chair Ahlan Marriott, White Elephant GmbH, Switzerland ahlan at Ada-Switzerland.ch - Publicity Chair Dirk Craeynest, Ada-Belgium & KU Leuven, Belgium Dirk.Craeynest at cs.kuleuven.be - Webmaster Hai Nam Tran, University of Brest, France hai-nam.tran at univ-brest.fr - Local Chair Nuria Sirvent, Barcelona Supercomputing Center, Spain nuria.sirvent at bsc.es *** Previous Editions Ada-Europe organizes annual international conferences since the early 80's. This is the 28th event in the Reliable Software Technologies series, previous ones being held at Montreux, Switzerland ('96), London, UK ('97), Uppsala, Sweden ('98), Santander, Spain ('99), Potsdam, Germany ('00), Leuven, Belgium ('01), Vienna, Austria ('02), Toulouse, France ('03), Palma de Mallorca, Spain ('04), York, UK ('05), Porto, Portugal ('06), Geneva, Switzerland ('07), Venice, Italy ('08), Brest, France ('09), Valencia, Spain ('10), Edinburgh, UK ('11), Stockholm, Sweden ('12), Berlin, Germany ('13), Paris, France ('14), Madrid, Spain ('15), Pisa, Italy ('16), Vienna, Austria ('17), Lisbon, Portugal ('18), Warsaw, Poland ('19), online from Santander, Spain ('21), Ghent, Belgium ('22), and Lisbon, Portugal ('23). Information on previous editions of the conference can be found at www.ada-europe.org/confs/ae. ----------------------------------------------------------------------- Our apologies if you receive multiple copies of this announcement. Please circulate widely. Dirk Craeynest, AEiC 2024 Publicity Chair Dirk.Craeynest@cs.kuleuven.be * 28th Ada-Europe Int. Conf. Reliable Software Technologies (AEiC 2024) * June 11-14, 2024, Barcelona, Spain, www.ada-europe.org/conference2024 (V1.1)
I created the issue below a little while ago. Today I wonder whether Ada 2022s 'Image attribute on records use of Unbounded strings is for good reason. Is it an oversight that Bounded String would work with the new light runtime or String with all runtimes including the older zero footprint runtimes? Perhaps it was decided that a light runtime would not use this feature? and I can cerrainly avoid it. However I use a light runtime with 100s of kilobytes or ram and many gigabytes of flash. Ada is a much nicer language than Rust which uses unsafe all over for embedded but one thing that is interesting is that I believe all Rust code can be run easily on any target. Should Ada aspire to that? On the other hand micros are becoming multiprocessor bringing more demand for tasking (protected types are not compatible with a light runtime) but personally I believe multi chip single core designs are far better than multicore and not only due to the impossibility of side channel attacks like spectre. https://github.com/Ada-Rapporteur-Group/User-Community-Input/issues/67 -- Regards, Kc
>> Or when they realize that there is only one rust compiler, and therefore
>> that a single compiler virus could ruin the whole defense system.
>
>Good point !
>
>Still some doubts about their ability to reason that far ;)
Whilst I have in the past refused to use lattice semi conductor hardware due
to a CDN preventing secure compiler verification, whilst apparently noone
or few noticed.
I assume you mean trojaned compiler code inserted upstream to disable
protections or ignore unsafe code?
Or do you mean utf-8 library code substitution aimed at a particular
compiler?
--
Regards, Kc
On 26/9/23 15:47, Vadim Godunko wrote:
> On Saturday, September 23, 2023 at 1:59:20 PM UTC+4, Rod Kay wrote:
>>
>> I've been using 'Gnat.formatted_Output' which I've found quite
>> useful. Unfortunately, it seems to be a little buggy with its formatting.
>
> You can take a look at VSS's Virtual_String_Templates and Formatters, see
>
> https://github.com/AdaCore/VSS/blob/master/source/text/vss-strings-templates.ads
> https://github.com/AdaCore/VSS/blob/master/source/text/vss-strings-formatters.ads
>
> and an example of its use
>
> https://github.com/AdaCore/gnatdoc/blob/3e94448ac57270caf4b4502f208f78e1d51da2b2/source/gnatdoc-messages.adb#L130
That looks really good! I'll try it out asap.
Thank you Vadim.
On 2023-09-26 9:13, Randy Brukardt wrote:
> ... for Janus/Ada, enumeration types with specified representations
> operate internally on the position numbers
Hm, that's interesting. Is that also the representation for record
components of such an enumerated type?
For example, if I have:
type Command is (Off, On) with Size => 4;
for Command use (Off => 2, On => 5);
type Two_Commands is record
C1, C2: Command;
end record
with Pack, Size => 8;
TwoC : Two_Commands := (C1 => On, C2 => Off);
will the record components (in memory) have the values C1 = 1 and C2 = 0
(position numbers) or C1 = 5, C2 = 2 (specified representation)?
If they are represented by position numbers in the record, many if not
most of my embedded Ada programs would fail if compiled with Janus/Ada,
because the record values stored in I/O control registers or accessed
via DMA would be wrong.
Damn, I thought those programs were not so compiler-dependent :-(
> Or when they realize that there is only one rust compiler, and therefore
> that a single compiler virus could ruin the whole defense system.
Good point !
Still some doubts about their ability to reason that far ;)
--
Stéphane Rivière
Ile d'Oléron - France
I believe Jeffrey's analysis is correct.
Note that there are some special cases for validity that are intended to
make it easier to write code like that you have. But they only make sense
for base subtypes (and the type you have is not that). Moreover, they are
not foolproof -- exceution is not erroneous in these cases, but they still
are a bounded error, and it is always correct for a bounded error to be
detected and raise Program_Error.
This can happen in practice, too. For instance, for Janus/Ada, enumeration
types with specified representations operate internally on the position
numbers, and thus reading an enumeration variable will convert the
representation to a position number with a table lookup. If the lookup
fails, Program_Error is raised, and that happens before the value ever can
be assigned to a named variable (and thus before any possible test of
validity). I believe that we identified other similar cases back in the day.
Probably one of them is the signalling NaN. Some bit patterns for float
values represent signalling NaNs, which trap instantly if read. That's at
the hardware level on most processors, so the only hope is the handle the
resulting exception. It's too late by the time you get to 'Valid.
Moral: to make truly bulletproof code, you have to handle exceptions AND use
'Valid. You probably can skip the exceptions if everything is typed with
integer basetypes, but if any other kinds of types are involved, they are
necessary.
Randy.
"Jeffrey R.Carter" <spam.jrcarter.not@spam.acm.org.not> wrote in message
news:uenmg1$qctd$1@dont-email.me...
> On 2023-09-23 22:22, Maciej Sobczak wrote:
>>
>> I have checked the above program on several on-line compilers, all of
>> them behave according to interpretation 2 above.
>> Richard claims to get behavior 1 on his compiler.
>>
>> What is your take on this? Any language lawyers?
>
> The important thing is the definition of Ada.Text_IO.Integer_IO.Get [ARM
> A.10.8(7-10)]:
>
> "... skips any leading blanks, line terminators, or page terminators, then
> reads a plus sign if present or (for a signed type only) a minus sign if
> present, then reads the longest possible sequence of characters matching
> the syntax of a numeric literal without a point. ...
>
> "Returns, in the parameter Item, the value of type Num that corresponds to
> the sequence input.
>
> "The exception Data_Error is propagated if the sequence of characters read
> does not form a legal integer literal or if the value obtained is not of
> the subtype Num."
>
> So a call to Get can only return a valid value of type Num (Integer for
> your case) or raise Data_Error.
>
> If Get is reading "500" then that certainly represents a valid value of
> type Integer, and Get should copy that back to the actual parameter.
>
> If you are using Ada (a language with run-time checks), then a check
> should be made that the value is in the range of the actual parameter's
> subtype, here Integer range 0 .. 200. That should fail and
> Constraint_Error should be raised.
>
> However, if you are not using Ada because that check has been suppressed,
> then the actual parameter will be left with the invalid value 500 and
> Constraint_Error will not be raised.
>
> If I build your program with checks enabled, I get Constraint_Error. If I
> build it with checks suppressed, I get the not-valid message (GNAT 12.3).
>
> --
> Jeff Carter
> "If you don't get the President of the United States on that
> phone, ... you're going to have to answer to the Coca-Cola
> Company."
> Dr. Strangelove
> 32
>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain, Size: 2080 bytes --] "J-P. Rosen" <rosen@adalog.fr> wrote in message news:uem2id$moia$1@dont-email.me... > Le 22/09/2023 à 22:05, Jeffrey R.Carter a écrit : >> On 2023-09-22 21:30, Blady wrote: >>> >>> A.10.7 Input-Output of Characters and Strings >>> For an item of type Character the following procedures are provided: >>> procedure Get(File : in File_Type; Item : out Character); >>> procedure Get(Item : out Character); >>> After skipping any line terminators and any page terminators, reads the >>> next character from the specified input file and returns the value of >>> this character in the out parameter Item. >>> The exception End_Error is propagated if an attempt is made to skip a >>> file terminator. >> >> As you have quoted, Get (Character) skips line terminators. End_Of_File >> returns True if there is a single line terminator before the file >> terminator, but False if there are multiple line terminators before the >> file terminator. So you either have to explicitly skip line terminators, >> or handle End_Error. >> > And this works only if the input file is "well formed", i.e. if it has > line terminators as the compiler expects them to be (f.e., you will be in > trouble if the last line has no LF). > That's why I never check End_Of_File, but handle the End_Error exception. > It always works. Agreed. And if the file might contain a page terminator, things get even worse because you would have to mess around with End_of_Page in order to avoid hitting a combination that still will raise End_Error. It's not worth the mental energy to avoid it, especially in a program that will be used by others. (I've sometimes used the simplest possible way to writing a "quick&dirty" program for my own use; for such programs I skip the error handling as I figure I can figure out what I did wrong by looking at the exception raised. But that's often a bad idea even in that case as such programs have a tendency to get reused years later and then the intended usage often isn't clear.) Randy.
On Saturday, September 23, 2023 at 1:59:20 PM UTC+4, Rod Kay wrote: > > I've been using 'Gnat.formatted_Output' which I've found quite > useful. Unfortunately, it seems to be a little buggy with its formatting. You can take a look at VSS's Virtual_String_Templates and Formatters, see https://github.com/AdaCore/VSS/blob/master/source/text/vss-strings-templates.ads https://github.com/AdaCore/VSS/blob/master/source/text/vss-strings-formatters.ads and an example of its use https://github.com/AdaCore/gnatdoc/blob/3e94448ac57270caf4b4502f208f78e1d51da2b2/source/gnatdoc-messages.adb#L130
It's not needless; there is an implicit conversion on an assignment, and it
only needs to work one way. When you rename a variable, the conversion has
to work both ways. But that's problematic, since conversions often involve
checks and we don't want checks popping up in unexpected places (both for
implementation reasons and for readability reasons).
Also, renaming does not change the nominal subtype of an object, regardless
of what subtype is given in the renames. Ada 2022 allows you to omit the
type name altogether since it provides little value.
Randy.
"Simon Belmont" <sbelmont700@gmail.com> wrote in message
news:5ab7e1d5-1491-49c3-877d-32bb6e12b43an@googlegroups.com...
On Thursday, September 21, 2023 at 5:03:06?PM UTC-4, G.B. wrote:
> O does not denote an object of a class-wide type,
> I think. However, P'Class (o) does, so that renaming
> that would make r be of its declared type P'Class.
That seems needlessly pedantic, considering that assignment is fine (o2 :
P'Class := o) as well as assigning it to an intermediate pointer (po :
access P'Class := o'Access; r : P'Class renames po.all)
Le 24/09/2023 à 09:50, Dmitry A. Kazakov a écrit : > On 2023-09-23 16:03, Niklas Holsti wrote: >> On 2023-09-23 10:02, J-P. Rosen wrote: >>> Le 22/09/2023 à 22:05, Jeffrey R.Carter a écrit :>>>> On 2023-09-22 21:30, Blady wrote: >>>> >>>> A.10.7 Input-Output of Characters and Strings >>>> For an item of type Character the following procedures are provided: >>>> procedure Get(File : in File_Type; Item : out Character); >>>> procedure Get(Item : out Character); >>>> After skipping any line terminators and any page terminators, reads >>>> the next character from the specified input file and returns the >>>> value of this character in the out parameter Item. >>>> The exception End_Error is propagated if an attempt is made to skip >>>> a file terminator. Thanks all for your helpful answers. It actually helps. Especially, I was not aware of the particular behavior of End_Of_File with a single line terminator before the file terminator. In my case, I prefer to reserve exceptions for exceptional situations :-) so I've took the code from Niklas example. Regards, Pascal.
On 25/09/2023 16:55, G.B. wrote: > What changes to Ada are a good fit while aiming > at memory safety, verification support, > or light weight and safe parallel execution? I started thinking about that here https://github.com/Lucretia/orenda.
On 25.09.23 12:38, J-P. Rosen wrote: > Le 25/09/2023 à 11:59, Stéphane Rivière a écrit : >>> How long before they relax the requirements >>> and idiots say "we can use C again, yay!"? >> By the time they discover Rust ? > > Or when they realize that there is only one rust compiler, and therefore that a single compiler virus could ruin the whole defense system. > Maybe, given the emphasis on tools, verification and best practices, they might consider sub-languages, or profiles, of several existing languages. It's not like memory-safety cannot be made available in languages other than Rust, I should think? Though, it seems to me that Rust has so much better market-aware development strategies than any other language since C, outside Microsoft's or Apple's areas of sales. Also, I understand that Linux kernel development is steered towards Rust and LLVM. So, they have decided not to go back to the 80s, just pick some good bits and move on, possibly producing grust or crust while at it. In order to pick well from Ada and the concepts embodied in it, imagine what parts of Ada should be thrown out, ignoring commercial enterprises living off legacy business? What changes to Ada are a good fit while aiming at memory safety, verification support, or light weight and safe parallel execution? As you can see in [1], there is a suggestion to make money available to refactoring efforts. [1]: https://www.federalregister.gov/d/2023-17239/p-37
Le 25/09/2023 à 11:59, Stéphane Rivière a écrit : >> How long before they relax the requirements >> and idiots say "we can use C again, yay!"? > By the time they discover Rust ? Or when they realize that there is only one rust compiler, and therefore that a single compiler virus could ruin the whole defense system. -- J-P. Rosen Adalog 2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX https://www.adalog.fr https://www.adacontrol.fr
> History is repeating itself. +1 > How long before they relax the requirements > and idiots say "we can use C again, yay!"? By the time they discover Rust ? -- Stéphane Rivière Ile d'Oléron - France
On 24/09/2023 23:28, ajdude wrote:
> The US Government is requesting information on adoption of memory safe
> programming languages and open-source software security. They’re currently
> taking comments until October 9th. I think this is a good opportunity to help
> bring Ada back into the spotlight.
>
> https://www.federalregister.gov/documents/2023/08/10/2023-17239/request-for-information-on-open-source-software-security-areas-of-long-term-focus-and-prioritization
History is repeating itself. How long before they relax the requirements
and idiots say "we can use C again, yay!"?
The US Government is requesting information on adoption of memory safe programming languages and open-source software security. They’re currently taking comments until October 9th. I think this is a good opportunity to help bring Ada back into the spotlight. https://www.federalregister.gov/documents/2023/08/10/2023-17239/request-for-information-on-open-source-software-security-areas-of-long-term-focus-and-prioritization AJ
When I try to execute gnatpp, I get the following errors: dick@dick1:~/src$ gnat --version GNAT 10.5.0 Copyright (C) 1996-2020, Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. dick@dick1:~/src$ gnatpp --version GNATPP 10.5.0 Copyright (C) 2004-2020, Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. dick@dick1:~/src$ gnatpp cursor.adb >usage gnat1: warning: unrecognized gcc debugging option: u gnat1: warning: unrecognized gcc debugging option: m gnat1: warning: unrecognized gcc debugging option: b gnat1: warning: unrecognized gcc debugging option: s gnat1: warning: unrecognized gcc debugging option: e gnat1: warning: unrecognized gcc debugging option: - gnat1: warning: unrecognized gcc debugging option: e gnat1: warning: unrecognized gcc debugging option: t gnat1: you must provide one source file gnatpp: cannot compile "cursor.adb" dick@dick1:~/src$ LInux Mint 21.2 Cinnamon Where should I report this?
"hn...@yahoo.de" <hnptz@yahoo.de> writes: > Ventura 13.5.2 So you're running on a Mac; mini? air? pro? M1/2? Intel? > I have downloaded GNATStudio 20230713 and gcc-13.2.0 ..., > then what shall I do next to get GNATStudio up and running? GNATStudio is an app, supplied as a .dmg. What I would do (subtly different from the README on Sourceforge) would be * go to your ~/Downloads directory, and in a terminal say xattr -c 20230713-Applications.dmg to remove the quarantine attributes (I think this is easier than waiting until you've installed it) * Either double-click on the .dmg in Finder, or in ~/Downloads say open 20230713-Applications.dmg and go through the standard installation dialog, which will install GNATStudio in your Applications directory. As to gcc-13.2.0 ... assuming this is a binary distribution, where did it come from? presumably there are installation instructions there? There's a note in the Sourceforge README about what to do if the compiler isn't at /opt/gcc-13.1.0/bin, but as far as I can tell GNATStudio will use the first compiler it finds on your PATH.
Simon Wright <simon@pushface.org> writes:
> I occurs to me that it might be _any_ static library? ... later
Yes, so it is. Damn.
> I have downloaded GNATStudio 20230713 and gcc-13.2.0 ..., > then what shall I do next to get GNATStudio up and running? If you are on Linux : https://github.com/sowebio/adel-doc/blob/master/Ada%20Development%20Environment%20on%20Linux.pdf More generaly, just install them and setup PATH to ../bin for both. -- Stéphane Rivière Ile d'Oléron - France
Ventura 13.5.2 I have downloaded GNATStudio 20230713 and gcc-13.2.0 ..., then what shall I do next to get GNATStudio up and running?
Leo Brewin <Leo.Brewin@monash.edu> writes:
> Hmm, this is odd. I'm having no problems.
> I'm running mac OS Ventura 13.6 (with the security update), CLT 15.0
> and gnat based on gcc 13.1.
I was under the impression that 13.6 _was_ a security update!
Investigation so far shows that linking against the static Ada runtime
(the default, -bargs -static) crashes, against the shared runtime
(-bargs -shared) is OK.
With 12.2.0, 13.1.0, 14.0.0.
I occurs to me that it might be _any_ static library? ... later
On 2023-09-23 16:03, Niklas Holsti wrote: > On 2023-09-23 12:25, Dmitry A. Kazakov wrote: >> You exit the loop and do whatever is necessary there. > > That is exactly what happens in the "while not End_Of_File" loop. It does not because you must handle I/O errors and close the file. > If you want to use End_Error instead, you have to add an exception > handler, and if you want to stay in the subprogram's statement sequence > without entering the subprogram-level exception handlers, you have to > add a block to contain the reading loop and make the exception handler > local to that block. You always have to in order to handle I/O errors. > To me that looks like adding code -> more complex. Of course not much > more complex, but a little, as I said. No, it is simpler if the code is production code rather than an exercise. Consider typical case when looping implements reading some message, block etc. You have loop read something read another piece read some count read a block of count bytes ... You cannot do it this way if you use end of file test because you must protect each minimal input item (e.g. byte) by the test. It is massively obtrusive and would distort program logic. You will end up with nested ifs or else gotos. >> Testing for the file end is unreliable and non-portable. Many types >> of files simply do not support that test.In other cases the test is >> not file immutable with the side effects that can change the program >> logic. > > I suppose you are talking about the need for End_Of_File to possibly > read ahead past a line terminator? If not, please clarify. Yes, reading ahead and also issues with blocking and with race condition in shared files. Then things like sockets do not have end of file, connection drop is indicated by an empty read. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
On 23/09/2023 23:37, Leo Brewin wrote: > On 23/9/2023 6:02 am, moi wrote: >> Installing the macOS Ventura 13.6 security update clobbers GNAT. >> Specifically, the link stage fails: >> >>> -macosx_version_min has been renamed to -macos_version_min >>> 0 0x104de0f43 __assert_rtn + 64 >>> 1 0x104ce2f43 ld::AtomPlacement::findAtom(unsigned char, unsigned >>> long long, ld::AtomPlacement::AtomLoc const*&, long long&) const + 1411 >>> 2 0x104cff431 >>> ld::InputFiles::SliceParser::parseObjectFile(mach_o::Header const*) >>> const + 19745 >>> 3 0x104d0fb71 ld::InputFiles::parseAllFiles(void (ld::AtomFile >>> const*) block_pointer)::$_7::operator()(unsigned long, ld::FileInfo >>> const&) const + 657 >>> 4 0x7ff80b631066 _dispatch_client_callout2 + 8 >>> 5 0x7ff80b642e09 _dispatch_apply_invoke + 213 >>> 6 0x7ff80b631033 _dispatch_client_callout + 8 >>> 7 0x7ff80b6410f6 _dispatch_root_queue_drain + 683 >>> 8 0x7ff80b641768 _dispatch_worker_thread2 + 170 >>> 9 0x7ff80b7cec0f _pthread_wqthread + 257 >>> ld: Assertion failed: (resultIndex < sectData.atoms.size()), function >>> findAtom, file Relocations.cpp, line 1336. >>> collect2: error: ld returned 1 exit status >>> gnatmake: *** link failed. >> >> Simon's "magic formula", '-largs -Wl,-ld_classic' restores sanity. >> I guess the CLTs were updated without asking permission. 8-( >> > > Hmm, this is odd. I'm having no problems. > I'm running mac OS Ventura 13.6 (with the security update), CLT 15.0 > and gnat based on gcc 13.1. > Ah! I'm still on GNAT 12.2.0. I should have added that, although the link phase works, it produces this message, which is new: > -macosx_version_min has been renamed to -macos_version_min And Free Pascal Compiler version 3.2.2 [2021/05/16] for x86_64 also complains, thus; > ld: warning: -multiply_defined is obsolete But again, the linking succeeds. -- Bill F.
On 23/9/2023 6:02 am, moi wrote:
> Installing the macOS Ventura 13.6 security update clobbers GNAT.
> Specifically, the link stage fails:
>
>> -macosx_version_min has been renamed to -macos_version_min
>> 0 0x104de0f43 __assert_rtn + 64
>> 1 0x104ce2f43 ld::AtomPlacement::findAtom(unsigned char, unsigned
>> long long, ld::AtomPlacement::AtomLoc const*&, long long&) const + 1411
>> 2 0x104cff431
>> ld::InputFiles::SliceParser::parseObjectFile(mach_o::Header const*)
>> const + 19745
>> 3 0x104d0fb71 ld::InputFiles::parseAllFiles(void (ld::AtomFile
>> const*) block_pointer)::$_7::operator()(unsigned long, ld::FileInfo
>> const&) const + 657
>> 4 0x7ff80b631066 _dispatch_client_callout2 + 8
>> 5 0x7ff80b642e09 _dispatch_apply_invoke + 213
>> 6 0x7ff80b631033 _dispatch_client_callout + 8
>> 7 0x7ff80b6410f6 _dispatch_root_queue_drain + 683
>> 8 0x7ff80b641768 _dispatch_worker_thread2 + 170
>> 9 0x7ff80b7cec0f _pthread_wqthread + 257
>> ld: Assertion failed: (resultIndex < sectData.atoms.size()), function
>> findAtom, file Relocations.cpp, line 1336.
>> collect2: error: ld returned 1 exit status
>> gnatmake: *** link failed.
>
> Simon's "magic formula", '-largs -Wl,-ld_classic' restores sanity.
> I guess the CLTs were updated without asking permission. 8-(
>
Hmm, this is odd. I'm having no problems.
I'm running mac OS Ventura 13.6 (with the security update), CLT 15.0
and gnat based on gcc 13.1.
On 2023-09-23 22:22, Maciej Sobczak wrote:
>
> I have checked the above program on several on-line compilers, all of them behave according to interpretation 2 above.
> Richard claims to get behavior 1 on his compiler.
>
> What is your take on this? Any language lawyers?
The important thing is the definition of Ada.Text_IO.Integer_IO.Get [ARM
A.10.8(7-10)]:
"... skips any leading blanks, line terminators, or page terminators, then reads
a plus sign if present or (for a signed type only) a minus sign if present, then
reads the longest possible sequence of characters matching the syntax of a
numeric literal without a point. ...
"Returns, in the parameter Item, the value of type Num that corresponds to the
sequence input.
"The exception Data_Error is propagated if the sequence of characters read does
not form a legal integer literal or if the value obtained is not of the subtype
Num."
So a call to Get can only return a valid value of type Num (Integer for your
case) or raise Data_Error.
If Get is reading "500" then that certainly represents a valid value of type
Integer, and Get should copy that back to the actual parameter.
If you are using Ada (a language with run-time checks), then a check should be
made that the value is in the range of the actual parameter's subtype, here
Integer range 0 .. 200. That should fail and Constraint_Error should be raised.
However, if you are not using Ada because that check has been suppressed, then
the actual parameter will be left with the invalid value 500 and
Constraint_Error will not be raised.
If I build your program with checks enabled, I get Constraint_Error. If I build
it with checks suppressed, I get the not-valid message (GNAT 12.3).
--
Jeff Carter
"If you don't get the President of the United States on that
phone, ... you're going to have to answer to the Coca-Cola
Company."
Dr. Strangelove
32
Hi there, I am in the middle of a heated debate with Richard Riehle on LinkedIn, where we cannot get to terms with regard to the exact semantics of X'Valid in the context of input operations performed by standard Get procedure. In short, consider the following example: with Ada.Text_IO; with Ada.Integer_Text_IO; procedure Is_Valid_Test is X : Integer range 0..200; begin Ada.Text_IO.Put("Get an Integer: "); Ada.Integer_Text_IO.Get(X); if X'Valid then Ada.Text_IO.Put_Line("The Input is Valid "); else Ada.Text_IO.Put_Line("The Input is not Valid "); end if; end Is_Valid_Test; When the input is 500, what should be the behavior of this program? There are two interpretations: 1. Get is an input operation and can create invalid representations (as stated in 13.9.2, p.7). Then, the X'Valid test that follows Get(X) can be used to safely recognize whether the value is in the range or not. The program should print the second string (from the else branch), but should not raise any exceptions for this input (500). 2. Get is not an input operation in the meaning referred to in 13.9.2/7, or is an input, but only for type Integer (and it cannot create invalid integer representations on typical computers anyway). The X variable is an actual parameter that has a subtype that is different from the formal parameter and is subject to conversions when the Get subprogram exits normally (6.4.1/17,17a). This conversion should raise Constraint_Error for this input (500). I have checked the above program on several on-line compilers, all of them behave according to interpretation 2 above. Richard claims to get behavior 1 on his compiler. What is your take on this? Any language lawyers? Regards, Maciej Sobczak
Simon Wright <simon@pushface.org> writes:
> I managed to avoid this this morning (I've been resisting the
> attempted upgrade to CLT 15.0) by looking to see what was proposed,
> seeing that there were 2 upgrades (Ventura & CLT), and unchecking the
> CLT.
And now it proposes to install it tonight. Ugh. Investigating what
happens if I turn off automatic installation of macOS updates ...
On 2023-09-23 12:25, Dmitry A. Kazakov wrote: > On 2023-09-23 10:39, Niklas Holsti wrote: >> On 2023-09-23 10:02, J-P. Rosen wrote: > >>> That's why I never check End_Of_File, but handle the End_Error >>> exception. It always works. >> >> True, but it may not be convenient for the overall logic of the >> program that reads the file. That program often wants do to something >> with the contents, after reading the whole file, and having to enter >> that part of the program through an exception does complicate the code >> a little. > > It rather simplifies the code. Oh? > You exit the loop and do whatever is necessary there. That is exactly what happens in the "while not End_Of_File" loop. If you want to use End_Error instead, you have to add an exception handler, and if you want to stay in the subprogram's statement sequence without entering the subprogram-level exception handlers, you have to add a block to contain the reading loop and make the exception handler local to that block. To me that looks like adding code -> more complex. Of course not much more complex, but a little, as I said. > Testing for the file end is unreliable and non-portable. Many types > of files simply do not support that test.In other cases the test is > not file immutable with the side effects that can change the program > logic. I suppose you are talking about the need for End_Of_File to possibly read ahead past a line terminator? If not, please clarify. That said, I certainly think that a program reading files should be prepared to handle End_Error, especially if a file is read at several places in the program (and not in a single loop as in the present program).
moi <findlaybill@blueyonder.co.uk> writes: > Installing the macOS Ventura 13.6 security update clobbers GNAT. > Specifically, the link stage fails: > >> -macosx_version_min has been renamed to -macos_version_min >> 0 0x104de0f43 __assert_rtn + 64 >> 1 0x104ce2f43 ld::AtomPlacement::findAtom(unsigned char, unsigned >> long long, ld::AtomPlacement::AtomLoc const*&, long long&) const + >> 1411 >> 2 0x104cff431 >> ld::InputFiles::SliceParser::parseObjectFile(mach_o::Header const*) >> const + 19745 >> 3 0x104d0fb71 ld::InputFiles::parseAllFiles(void (ld::AtomFile >> const*) block_pointer)::$_7::operator()(unsigned long, ld::FileInfo >> const&) const + 657 >> 4 0x7ff80b631066 _dispatch_client_callout2 + 8 >> 5 0x7ff80b642e09 _dispatch_apply_invoke + 213 >> 6 0x7ff80b631033 _dispatch_client_callout + 8 >> 7 0x7ff80b6410f6 _dispatch_root_queue_drain + 683 >> 8 0x7ff80b641768 _dispatch_worker_thread2 + 170 >> 9 0x7ff80b7cec0f _pthread_wqthread + 257 >> ld: Assertion failed: (resultIndex < sectData.atoms.size()), >> function findAtom, file Relocations.cpp, line 1336. >> collect2: error: ld returned 1 exit status >> gnatmake: *** link failed. > > Simon's "magic formula", '-largs -Wl,-ld_classic' restores sanity. > I guess the CLTs were updated without asking permission. 8-( I managed to avoid this this morning (I've been resisting the attempted upgrade to CLT 15.0) by looking to see what was proposed, seeing that there were 2 upgrades (Ventura & CLT), and unchecking the CLT. Iain Sandoe recommends[1] re-installing 14.3 (you should be able to download it from the developer.apple.com website, although you do need an apple ID to do that) [1] https://github.com/iains/gcc-12-branch/issues/22#issuecomment-1730213294
I might give a small talk on swig4ada, if that would be of interest. If it's possible to request talks, I'd love to see an overview of 'Pragmarc' and 'Simple Components' by Jeffrey and Dmitry. I used the neural net component of Pragmarc many years ago but have not kept up with Pragmarcs development. Also, I've been meaning to look into Simple Components for quite a while. Regards.
Thank you all for the interesting replies and apologies for not replying sooner. I've been using 'Gnat.formatted_Output' which I've found quite useful. Unfortunately, it seems to be a little buggy with its formatting.
On 2023-09-23 10:39, Niklas Holsti wrote: > On 2023-09-23 10:02, J-P. Rosen wrote: >> That's why I never check End_Of_File, but handle the End_Error >> exception. It always works. > > True, but it may not be convenient for the overall logic of the program > that reads the file. That program often wants do to something with the > contents, after reading the whole file, and having to enter that part of > the program through an exception does complicate the code a little. It rather simplifies the code. You exit the loop and do whatever is necessary there. Testing for the file end is unreliable and non-portable. Many types of files simply do not support that test. In other cases the test is not file immutable with the side effects that can change the program logic. It is well advised to never ever use it. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
On 2023-09-23 10:02, J-P. Rosen wrote: > Le 22/09/2023 à 22:05, Jeffrey R.Carter a écrit : >> On 2023-09-22 21:30, Blady wrote: >>> >>> A.10.7 Input-Output of Characters and Strings >>> For an item of type Character the following procedures are provided: >>> procedure Get(File : in File_Type; Item : out Character); >>> procedure Get(Item : out Character); >>> After skipping any line terminators and any page terminators, reads >>> the next character from the specified input file and returns the >>> value of this character in the out parameter Item. >>> The exception End_Error is propagated if an attempt is made to skip a >>> file terminator. >> >> As you have quoted, Get (Character) skips line terminators. >> End_Of_File returns True if there is a single line terminator before >> the file terminator, but False if there are multiple line terminators >> before the file terminator. So you either have to explicitly skip line >> terminators, or handle End_Error. >> > And this works only if the input file is "well formed", i.e. if it has > line terminators as the compiler expects them to be (f.e., you will be > in trouble if the last line has no LF). Hm. The code I suggested, which handles line terminators separately, does work without raising End_Error even if the last line has no line terminator, at least in the context of the OP's program. > That's why I never check End_Of_File, but handle the End_Error > exception. It always works. True, but it may not be convenient for the overall logic of the program that reads the file. That program often wants do to something with the contents, after reading the whole file, and having to enter that part of the program through an exception does complicate the code a little. On the other hand, past posts on this issue say that using End_Error instead of the End_Of_File function is faster, probably because the Text_IO code that implements Get cannot know that the program has already checked for End_Of_File, so Get has to check for that case anyway, redundantly. My usual method for reading text files is to use Text_IO.Get_Line, and (I admit) usually with End_Error termination.
Le 22/09/2023 à 22:05, Jeffrey R.Carter a écrit : > On 2023-09-22 21:30, Blady wrote: >> >> A.10.7 Input-Output of Characters and Strings >> For an item of type Character the following procedures are provided: >> procedure Get(File : in File_Type; Item : out Character); >> procedure Get(Item : out Character); >> After skipping any line terminators and any page terminators, reads >> the next character from the specified input file and returns the value >> of this character in the out parameter Item. >> The exception End_Error is propagated if an attempt is made to skip a >> file terminator. > > As you have quoted, Get (Character) skips line terminators. End_Of_File > returns True if there is a single line terminator before the file > terminator, but False if there are multiple line terminators before the > file terminator. So you either have to explicitly skip line terminators, > or handle End_Error. > And this works only if the input file is "well formed", i.e. if it has line terminators as the compiler expects them to be (f.e., you will be in trouble if the last line has no LF). That's why I never check End_Of_File, but handle the End_Error exception. It always works. -- J-P. Rosen Adalog 2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX https://www.adalog.fr https://www.adacontrol.fr
On 2023-09-22 21:30, Blady wrote:
>
> A.10.7 Input-Output of Characters and Strings
> For an item of type Character the following procedures are provided:
> procedure Get(File : in File_Type; Item : out Character);
> procedure Get(Item : out Character);
> After skipping any line terminators and any page terminators, reads the next
> character from the specified input file and returns the value of this character
> in the out parameter Item.
> The exception End_Error is propagated if an attempt is made to skip a file
> terminator.
As you have quoted, Get (Character) skips line terminators. End_Of_File returns
True if there is a single line terminator before the file terminator, but False
if there are multiple line terminators before the file terminator. So you either
have to explicitly skip line terminators, or handle End_Error.
--
Jeff Carter
"Unix and C are the ultimate computer viruses."
Richard Gabriel
99
Installing the macOS Ventura 13.6 security update clobbers GNAT.
Specifically, the link stage fails:
> -macosx_version_min has been renamed to -macos_version_min
> 0 0x104de0f43 __assert_rtn + 64
> 1 0x104ce2f43 ld::AtomPlacement::findAtom(unsigned char, unsigned long long, ld::AtomPlacement::AtomLoc const*&, long long&) const + 1411
> 2 0x104cff431 ld::InputFiles::SliceParser::parseObjectFile(mach_o::Header const*) const + 19745
> 3 0x104d0fb71 ld::InputFiles::parseAllFiles(void (ld::AtomFile const*) block_pointer)::$_7::operator()(unsigned long, ld::FileInfo const&) const + 657
> 4 0x7ff80b631066 _dispatch_client_callout2 + 8
> 5 0x7ff80b642e09 _dispatch_apply_invoke + 213
> 6 0x7ff80b631033 _dispatch_client_callout + 8
> 7 0x7ff80b6410f6 _dispatch_root_queue_drain + 683
> 8 0x7ff80b641768 _dispatch_worker_thread2 + 170
> 9 0x7ff80b7cec0f _pthread_wqthread + 257
> ld: Assertion failed: (resultIndex < sectData.atoms.size()), function findAtom, file Relocations.cpp, line 1336.
> collect2: error: ld returned 1 exit status
> gnatmake: *** link failed.
Simon's "magic formula", '-largs -Wl,-ld_classic' restores sanity.
I guess the CLTs were updated without asking permission. 8-(
--
Bill F.
On 2023-09-22 22:30, Blady wrote:
> Hello,
>
> I'm reading a text file with Get character from Text_IO with a while
> loop controlled by End_Of_File.
>
> % cat test_20230922_get_char.adb
> with Ada.Text_IO; use Ada.Text_IO;
> procedure test_20230922_get_char is
> procedure Get is
> F : File_Type;
> Ch : Character;
> begin
> Open (F, In_File, "test_20230922_get_char.adb");
> while not End_Of_File(F) loop
> Get (F, Ch);
> Put (Ch);
> end loop;
> Close (F);
> Put_Line ("File read with get.");
> end;
> begin
> Get;
> end;
>
>
>
> All will be well, unfortunately not!
>
> Despite the End_Of_File, I got an END_ERROR exception when there are
> several trailing new lines at the end of the text:
>
> % test_20230922_get_char
> with Ada.Text_IO; use Ada.Text_IO;procedure test_20230922_get_char is
> procedure Get is F : File_Type; Ch : Character; begin Open
> (F, In_File, "test_20230922_get_char.adb"); while not
> End_Of_File(F) loop Get (F, Ch); Put (Ch); end
> loop; Close (F); Put_Line ("File read with get.");
> end;beginGet;end;
>
> Execution of ../bin/test_20230922_get_char terminated by unhandled
> exception
> raised ADA.IO_EXCEPTIONS.END_ERROR : a-textio.adb:517
>
> The code is compiled with GNAT, does it comply with the standard?
>
> A.10.7 Input-Output of Characters and Strings
> For an item of type Character the following procedures are provided:
> procedure Get(File : in File_Type; Item : out Character);
> procedure Get(Item : out Character);
> After skipping any line terminators and any page terminators, reads the
> next character from the specified input file and returns the value of
> this character in the out parameter Item.
> The exception End_Error is propagated if an attempt is made to skip a
> file terminator.
>
> This seems to be the case, then how to avoid the exception?
In Text_IO, a line terminator is not an ordinary character, so you must
handle it separately, for example like this:
while not End_Of_File(F) loop
if End_Of_Line(F) then
New_Line;
Skip_Line(F);
else
Get (F, Ch);
Put (Ch);
end if;
Hello, I'm reading a text file with Get character from Text_IO with a while loop controlled by End_Of_File. % cat test_20230922_get_char.adb with Ada.Text_IO; use Ada.Text_IO; procedure test_20230922_get_char is procedure Get is F : File_Type; Ch : Character; begin Open (F, In_File, "test_20230922_get_char.adb"); while not End_Of_File(F) loop Get (F, Ch); Put (Ch); end loop; Close (F); Put_Line ("File read with get."); end; begin Get; end; All will be well, unfortunately not! Despite the End_Of_File, I got an END_ERROR exception when there are several trailing new lines at the end of the text: % test_20230922_get_char with Ada.Text_IO; use Ada.Text_IO;procedure test_20230922_get_char is procedure Get is F : File_Type; Ch : Character; begin Open (F, In_File, "test_20230922_get_char.adb"); while not End_Of_File(F) loop Get (F, Ch); Put (Ch); end loop; Close (F); Put_Line ("File read with get."); end;beginGet;end; Execution of ../bin/test_20230922_get_char terminated by unhandled exception raised ADA.IO_EXCEPTIONS.END_ERROR : a-textio.adb:517 The code is compiled with GNAT, does it comply with the standard? A.10.7 Input-Output of Characters and Strings For an item of type Character the following procedures are provided: procedure Get(File : in File_Type; Item : out Character); procedure Get(Item : out Character); After skipping any line terminators and any page terminators, reads the next character from the specified input file and returns the value of this character in the out parameter Item. The exception End_Error is propagated if an attempt is made to skip a file terminator. This seems to be the case, then how to avoid the exception? Thanks, Pascal.
Look like a compiler error. Note that @ is brand new, and your left-hand side is quite complicated..
Simon Belmont <sbelmont700@gmail.com> writes:
> r : P'Class renames o; --error
This compiles OK with GCC 13.1.0:
r : P'Class renames P'Class (o);
-- Assume the following ordered_map: package n_cells1_p is new ada.containers.ordered_maps (key_type => celltype1_t, element_type => Natural); use n_cells1_p; n_cells1 : n_cells1_p.map; -- This statemanet is OK according to latest gnat (latest alire release): n_cells1(cells1(e.id).type1) := n_cells1(cells1(e.id).type1) + 1; -- But the compiler does not like this: n_cells1(cells1(e.id).type1) := @ + 1; (giving messages: error: expected type universal integer error: found private type "Ada.Containers.Ordered_Maps.Reference_Type" ... OK, I can live with the first alternative, but I would like to know... reinert
On Thursday, September 21, 2023 at 5:03:06 PM UTC-4, G.B. wrote:
> O does not denote an object of a class-wide type,
> I think. However, P'Class (o) does, so that renaming
> that would make r be of its declared type P'Class.
That seems needlessly pedantic, considering that assignment is fine (o2 : P'Class := o) as well as assigning it to an intermediate pointer (po : access P'Class := o'Access; r : P'Class renames po.all)
On 21.09.23 21:29, Simon Belmont wrote:
> is it really illegal to rename an object as it's classwide parent? gnat claims so. Similar results using a type extension as a generic formal "in out" object of classwide type.
>
> declare
> type P is interface;
> type C is new P with null record;
>
> o : C;
> r : P'Class renames o; --error
> begin
> null;
> end;
>
> expected type "P'Class" defined at line
> found type "C" defined at line
O does not denote an object of a class-wide type,
I think. However, P'Class (o) does, so that renaming
that would make r be of its declared type P'Class.
is it really illegal to rename an object as it's classwide parent? gnat claims so. Similar results using a type extension as a generic formal "in out" object of classwide type. declare type P is interface; type C is new P with null record; o : C; r : P'Class renames o; --error begin null; end; expected type "P'Class" defined at line found type "C" defined at line
Hello.all, Has anyone had any success using openGL in GtkAda ? I tried a quick test today and although the 'Gtk.GLArea' and 'Gdk.GLContext' packages are present, I was unable to get a GL context. Also, the testgtk program has no openGL demo, as it used to have. I used openGL/GtkAda to good effect many years ago. Has openGL support then been dropped completely ? I recall there was a Gtk3 bug related to openGL and thought that might possibly be the reason why it is absent in GtkAda. Does GtkAda use Gtk4, yet ? I'm quite keen to try my hand at game programming (and have developed an Ada game engine library), so any advice/info would be greatly appreciated. Regards.
On 20/09/2023 10:35, Simon Wright wrote:
> if you accept the Xcode/Command Line Tools upgrade to 15.0, you’ll get
> crashes in the linker (`ld`). If you can’t resist the upgrade, gnatmake
> or gprbuild with `-largs -Wl,-ld_classic`.
>
> You probably won’t be offered the upgrade unless you’re already running
> Ventura.
Thanks for the warning, I had been considering taking the offer!
--
Bill F.
if you accept the Xcode/Command Line Tools upgrade to 15.0, you’ll get crashes in the linker (`ld`). If you can’t resist the upgrade, gnatmake or gprbuild with `-largs -Wl,-ld_classic`. You probably won’t be offered the upgrade unless you’re already running Ventura.
> > Please take a look at my Euler tools repository, https://github.com/rocher/euler_tools (not the best math lib you'll find, I know). > > I used this library tools to solve problem 26 here: https://github.com/rocher/alice-project_euler-rocher > > Let me know what you think. > sorry for reply so late. I just do not know how to install the lib to my GNAT. First of all, you need to install Alire on your system: https://alire.ada.dev Second, simply follow these steps: 1. Clone euler_tools: "git clone https://github.com/rocher/euler_tools" 2. Enter examples directory: "cd euler_tools/examples" 3. Build examples: "alr build" Included examples are problems 26 and 29 (discussed in another thread). If you'd like to discuss any other Project Euler problem, I have solved from 1 to 30 (at the moment). It'll be a pleasure to review/discuss any other problem. BR --- Francesc Rocher
Paul Rubin <no.email@nospam.invalid> writes:
> Ben Bacarisse <ben.usenet@bsb.me.uk> writes:
>> $ git clone git@github.com/rocher/euler_tools
>> fatal: repository 'git@github.com/rocher/euler_tools' does not exist
>
> Try the https link instead.
I said it worked in the text just prior to the part you quoted!
--
Ben.
> Typo: it should be g...@github.com:rocher/euler_tools
Damn it! The server modifies the address!!
It should say, without spaces: git [at] github.com:rocher/euler_tools
BR
---
Francesc Rocher
> > $ git clone g...@github.com/rocher/euler_tools
> > fatal: repository 'g...@github.com/rocher/euler_tools' does not exist
Typo: it should be git@github.com:rocher/euler_tools
As Paul said, it requires having a github account configured with an ssh key.
BR
---
Francesc Rocher
Ben Bacarisse <ben.usenet@bsb.me.uk> writes:
> $ git clone git@github.com/rocher/euler_tools
> fatal: repository 'git@github.com/rocher/euler_tools' does not exist
Try the https link instead. You may need to enroll an ssh public key on
github for the other way to work. Also maybe try euler_tools.git
instead of just euler_tools. I'm in the middle of something right now
but can check on it tonight if you don't have any luck and if Francesc
doesn't get back to you.
Francesc Rocher <francesc.rocher@gmail.com> writes:
>> I am curious, but only if it's not too much work.
>
> Pre-condition: alr must be installed in your system.
> Then, three simple steps:
>
> 1. this: git clone git@github.com/rocher/euler_tools
> or: git clone https://github.com/rocher/euler_tools
> 2. cd euler_tools/examples
> 3. alr build
Thanks. The https clone worked but I got
$ git clone git@github.com/rocher/euler_tools
fatal: repository 'git@github.com/rocher/euler_tools' does not exist
from the first.
--
Ben.
> I am curious, but only if it's not too much work. Pre-condition: alr must be installed in your system. Then, three simple steps: 1. this: git clone git@github.com/rocher/euler_tools or: git clone https://github.com/rocher/euler_tools 2. cd euler_tools/examples 3. alr build Included examples are problems 26 (discussed in a different thread) and 29. BR --- Francesc Rocher
Francesc Rocher <francesc.rocher@gmail.com> writes: >> > But Francesc's program doesn't use that method. It only suggests it in >> > a comment. The program actually works by building a list, sorting it, >> > and counting the groups. > >> I only looked briefly and thought it used the factor method to decide if >> the power is one that occurs earlier in the sequence. Two trivial >> things, starting with Answer as the full NxN count and then decrementing >> Answer made me think that was what it was doing. > > Exactly, I thought so. > Implementing the equality operator for a**b = x**y is also an > alternative algorithm. Using it would require a loop for a in 2..99, > b in 2..100, x in a+1..100 and y in 2..100. Is this correct? Or are > there other constraints? Well I just stored the unique pairs found so far. It's not very efficient, but perfectly fast enough for a,b in [2, 100]. > If anyone is interested, for performance comparison or whatever reason, I can > provide a stand alone version. I am curious, but only if it's not too much work. -- Ben.
> > But Francesc's program doesn't use that method. It only suggests it in > > a comment. The program actually works by building a list, sorting it, > > and counting the groups. > I only looked briefly and thought it used the factor method to decide if > the power is one that occurs earlier in the sequence. Two trivial > things, starting with Answer as the full NxN count and then decrementing > Answer made me think that was what it was doing. Exactly, that's the point: to find if for a given base+exponent a**b there is an equivalent x**y with 2 <= a < x <= 100 and 2 <= y <= 100, first a and b are factored as a product of prime numbers. In case a has multiple times the same factor, e.g. 27 = 3*3*3 = 3**3, then the exponent 3 is used as a new factor of the exponent. Introducing this factor requires that the list of factors of b must be sorted to find a new base x, a < x. Otherwise you could find x > 100 and consider that there is no such pair x and y within the limits. That's the only reason the list of factors is sorted when a new one is introduced. Example: 27**100 = (3*3*3)**(2*2*5*5) = (3**3)**(2*2*5*5) = 3**(2*2*3*5*5) = 9**(2*3*5*5) = 81**(3*5*5) = 81**75 On the other hand, the algorithm first assumes that all possible combinations of a**b are unique, and then subtracts 1 each time x and y are found for a and b. Implementing the equality operator for a**b = x**y is also an alternative algorithm. Using it would require a loop for a in 2..99, b in 2..100, x in a+1..100 and y in 2..100. Is this correct? Or are there other constraints? Anyway, for big numbers, having the equality operator a**b = x**y with the factoring method is a good idea. Unfortunately, my Project Euler programs are prepared to be inserted into the new Alice project, which is a (big) work in progress and cannot be compiled easily (it requires Alire, Project Euler for Alice and my sources, which depend on the Euler Tools). If anyone is interested, for performance comparison or whatever reason, I can provide a stand alone version. BR, -- Francesc Rocher
Paul Rubin <no.email@nospam.invalid> writes:
> Ben Bacarisse <ben.usenet@bsb.me.uk> writes:
>>> So you just loop through 1 <= a,b <= 100 and count only the a,b pairs
>>> where a is the smallest a for its equivalence class.
>> This is likely to be fast which is why I wanted to compile Francesc's to
>> try it out. Mind you, a naive a^b == c^d test gives pretty good
>> performance for the kind of range requested.
>
> But Francesc's program doesn't use that method. It only suggests it in
> a comment. The program actually works by building a list, sorting it,
> and counting the groups.
I only looked briefly and thought it used the factor method to decide if
the power is one that occurs earlier in the sequence. Two trivial
things, starting with Answer as the full NxN count and then decrementing
Answer made me think that was what it was doing.
--
Ben.
Ben Bacarisse <ben.usenet@bsb.me.uk> writes:
>> So you just loop through 1 <= a,b <= 100 and count only the a,b pairs
>> where a is the smallest a for its equivalence class.
> This is likely to be fast which is why I wanted to compile Francesc's to
> try it out. Mind you, a naive a^b == c^d test gives pretty good
> performance for the kind of range requested.
But Francesc's program doesn't use that method. It only suggests it in
a comment. The program actually works by building a list, sorting it,
and counting the groups.
Paul Rubin <no.email@nospam.invalid> writes:
> Ben Bacarisse <ben.usenet@bsb.me.uk> writes:
>>> Also, do you have a different approach to solve this 29th problem?
>>
>> Yes, but it's not in Ada. I implemented an equality test for a^b ==
>> c^d.
>
> Oh interesting, based on a comment in Francesc's code, I think I see a
> method to do it without the auxiliary array, at a small increase in
> runtime cost. Basically given a and b, you can find their prime factors
> and easily enumerate the combinations x,y with a**b==x**y and
> 1 <= x,y <= 100. You can label each "equivalence class" by the (a,b)
> with the smallest possible a.
>
> So you just loop through 1 <= a,b <= 100 and count only the a,b pairs
> where a is the smallest a for its equivalence class. I might see if I
> can code this, which should also let me describe it more concisely.
This is likely to be fast which is why I wanted to compile Francesc's to
try it out. Mind you, a naive a^b == c^d test gives pretty good
performance for the kind of range requested.
--
Ben.
Ben Bacarisse <ben.usenet@bsb.me.uk> writes:
>> Also, do you have a different approach to solve this 29th problem?
>
> Yes, but it's not in Ada. I implemented an equality test for a^b ==
> c^d.
Oh interesting, based on a comment in Francesc's code, I think I see a
method to do it without the auxiliary array, at a small increase in
runtime cost. Basically given a and b, you can find their prime factors
and easily enumerate the combinations x,y with a**b==x**y and
1 <= x,y <= 100. You can label each "equivalence class" by the (a,b)
with the smallest possible a.
So you just loop through 1 <= a,b <= 100 and count only the a,b pairs
where a is the smallest a for its equivalence class. I might see if I
can code this, which should also let me describe it more concisely.
Francesc Rocher <francesc.rocher@gmail.com> writes: > El dia dissabte, 16 de setembre de 2023 a les 23:56:11 UTC+2, Ben Bacarisse va escriure: >> Ben Bacarisse <ben.u...@bsb.me.uk> writes: >> >> > Francesc Rocher <frances...@gmail.com> writes: >> > >> >> El dia divendres, 15 de setembre de 2023 a les 17:42:43 UTC+2, Ben Bacarisse va escriure: >> >>> "CSYH (QAQ)" <sche...@asu.edu> writes: >> >>> >> >>> > Now this time, I am facing trouble for problem #29. As I know integer >> >>> > type is for 32 bits. but for this problem as me to find out the 2 ** >> >>> > 100 and even 100 ** 100. I used python to get the answer correctly in >> >>> > 5 minutes. >> >> >> >>> Most of the Project Euler problems have solutions that are not always >> >>> the obvious one (though sometimes the obvious one is the best). You >> >>> can, of course, just use a big number type (or write your own!) but this >> >>> problem can be solved without having to use any large numbers at all. >> >> >> >> Please take a look at this solution: >> >> https://github.com/rocher/alice-project_euler-rocher/blob/main/src/0001-0100/p0029_distinct_powers.adb >> > >> > Why? >> That came over as rather curt. I meant what is it about the code that >> you are drawing my attention to -- its particular use of Ada, its >> structure, the algorithm, the performance...? What (and where) is >> Euler_Tools? > > Well, I was sending the answer to the thread, not to anyone in > particular. I see. > I simply thought that, since you mention that this can be solved > without having to use big numbers, people in this group could be > interested in seeing how. My solution to this problem dates back to > earlier this year, when I solved the first 30 problems of Project > Euler. > > Euler_Tools is a repository of functions that I'm collecting while > solving new problems of Project Euler. In case you want to take a > look, https://github.com/rocher/euler_tools I was more interested to see if I could compile your code to compare timings etc, but I don't know how to put the pieces together. > Also, do you have a different approach to solve this 29th problem? Yes, but it's not in Ada. I implemented an equality test for a^b == c^d. -- Ben.
Francesc Rocher <francesc.rocher@gmail.com> writes:
> Also, do you have a different approach to solve this 29th problem?
I see two natural approaches: 1) use bignums--it didn't occur to me to
not use them until this discussion. 2) Notice that a**b == c**d exactly
when the two sides have the same prime factorization, and the factors
of a**b are just the factors of a repeated b times, so you can count up
the distinct tuples of factors.
Method #2 is efficient (since a,b,c,d are all < 100) and doesn't use
bignums, but it is a fair amount of code to write unless you have
convenient libraries at hand for factorization and can easily count sets
of distinct tuples. I guess there are fancier approaches possible too,
that avoid searching 100**2 combinations, but 100**2 is just 10000 which
is small.
Certainly both are easier to do if your language or libraries has
convenient features for dealing with variable sized objects like
bignums, or sets of tuples. The bignum approach is less efficient but
it is much easier to code. The Python expression
len(set(a**b for a in range(2,101) for b in range(2,101)))
takes around 25 msec to compute on my old slow laptop.
I will look at your Ada solution!
El dia dissabte, 16 de setembre de 2023 a les 23:56:11 UTC+2, Ben Bacarisse va escriure: > Ben Bacarisse <ben.u...@bsb.me.uk> writes: > > > Francesc Rocher <frances...@gmail.com> writes: > > > >> El dia divendres, 15 de setembre de 2023 a les 17:42:43 UTC+2, Ben Bacarisse va escriure: > >>> "CSYH (QAQ)" <sche...@asu.edu> writes: > >>> > >>> > Now this time, I am facing trouble for problem #29. As I know integer > >>> > type is for 32 bits. but for this problem as me to find out the 2 ** > >>> > 100 and even 100 ** 100. I used python to get the answer correctly in > >>> > 5 minutes. > >> > >>> Most of the Project Euler problems have solutions that are not always > >>> the obvious one (though sometimes the obvious one is the best). You > >>> can, of course, just use a big number type (or write your own!) but this > >>> problem can be solved without having to use any large numbers at all. > >> > >> Please take a look at this solution: > >> https://github.com/rocher/alice-project_euler-rocher/blob/main/src/0001-0100/p0029_distinct_powers.adb > > > > Why? > That came over as rather curt. I meant what is it about the code that > you are drawing my attention to -- its particular use of Ada, its > structure, the algorithm, the performance...? What (and where) is > Euler_Tools? Well, I was sending the answer to the thread, not to anyone in particular. I simply thought that, since you mention that this can be solved without having to use big numbers, people in this group could be interested in seeing how. My solution to this problem dates back to earlier this year, when I solved the first 30 problems of Project Euler. Euler_Tools is a repository of functions that I'm collecting while solving new problems of Project Euler. In case you want to take a look, https://github.com/rocher/euler_tools Also, do you have a different approach to solve this 29th problem? BR --- Francesc Rocher
On 9/17/23 13:42, reinert wrote:
> søndag 17. september 2023 kl. 19:27:12 UTC+2 skrev richardthiebaud:
>> I have a main program crypt.adb I have a seperate project randproj.ads
>> and randproj.adb crypt has a line "with randproj" but when I compile
>> crypt either directly with gnat or with alr it does not find randproj.
>>
>> crypt.adb, randproj.ads, and randproj.adb are all in the same directory.
>>
>> I have the feeling I'm missing something easy to do.
>>
>> How do I get crypt.adb to find randproj.ads?
>
> In the gpr file, have you: for Source_Dirs use ("src", ...
> ?
Thanks, that did it.
søndag 17. september 2023 kl. 19:27:12 UTC+2 skrev richardthiebaud:
> I have a main program crypt.adb I have a seperate project randproj.ads
> and randproj.adb crypt has a line "with randproj" but when I compile
> crypt either directly with gnat or with alr it does not find randproj.
>
> crypt.adb, randproj.ads, and randproj.adb are all in the same directory.
>
> I have the feeling I'm missing something easy to do.
>
> How do I get crypt.adb to find randproj.ads?
In the gpr file, have you: for Source_Dirs use ("src", ...
?
I have a main program crypt.adb I have a seperate project randproj.ads and randproj.adb crypt has a line "with randproj" but when I compile crypt either directly with gnat or with alr it does not find randproj. crypt.adb, randproj.ads, and randproj.adb are all in the same directory. I have the feeling I'm missing something easy to do. How do I get crypt.adb to find randproj.ads?
Ben Bacarisse <ben.usenet@bsb.me.uk> writes:
> Francesc Rocher <francesc.rocher@gmail.com> writes:
>
>> El dia divendres, 15 de setembre de 2023 a les 17:42:43 UTC+2, Ben Bacarisse va escriure:
>>> "CSYH (QAQ)" <sche...@asu.edu> writes:
>>>
>>> > Now this time, I am facing trouble for problem #29. As I know integer
>>> > type is for 32 bits. but for this problem as me to find out the 2 **
>>> > 100 and even 100 ** 100. I used python to get the answer correctly in
>>> > 5 minutes.
>>
>>> Most of the Project Euler problems have solutions that are not always
>>> the obvious one (though sometimes the obvious one is the best). You
>>> can, of course, just use a big number type (or write your own!) but this
>>> problem can be solved without having to use any large numbers at all.
>>
>> Please take a look at this solution:
>> https://github.com/rocher/alice-project_euler-rocher/blob/main/src/0001-0100/p0029_distinct_powers.adb
>
> Why?
That came over as rather curt. I meant what is it about the code that
you are drawing my attention to -- its particular use of Ada, its
structure, the algorithm, the performance...? What (and where) is
Euler_Tools?
--
Ben.
Francesc Rocher <francesc.rocher@gmail.com> writes:
> El dia divendres, 15 de setembre de 2023 a les 17:42:43 UTC+2, Ben Bacarisse va escriure:
>> "CSYH (QAQ)" <sche...@asu.edu> writes:
>>
>> > Now this time, I am facing trouble for problem #29. As I know integer
>> > type is for 32 bits. but for this problem as me to find out the 2 **
>> > 100 and even 100 ** 100. I used python to get the answer correctly in
>> > 5 minutes.
>
>> Most of the Project Euler problems have solutions that are not always
>> the obvious one (though sometimes the obvious one is the best). You
>> can, of course, just use a big number type (or write your own!) but this
>> problem can be solved without having to use any large numbers at all.
>
> Please take a look at this solution:
> https://github.com/rocher/alice-project_euler-rocher/blob/main/src/0001-0100/p0029_distinct_powers.adb
Why?
--
Ben.
El dia divendres, 15 de setembre de 2023 a les 17:42:43 UTC+2, Ben Bacarisse va escriure: > "CSYH (QAQ)" <sche...@asu.edu> writes: > > > Now this time, I am facing trouble for problem #29. As I know integer > > type is for 32 bits. but for this problem as me to find out the 2 ** > > 100 and even 100 ** 100. I used python to get the answer correctly in > > 5 minutes. > Most of the Project Euler problems have solutions that are not always > the obvious one (though sometimes the obvious one is the best). You > can, of course, just use a big number type (or write your own!) but this > problem can be solved without having to use any large numbers at all. Please take a look at this solution: https://github.com/rocher/alice-project_euler-rocher/blob/main/src/0001-0100/p0029_distinct_powers.adb It's not using any big numbers library. --- Francesc Rocher
"Blady" <p.p11@orange.fr> wrote in message
news:udvooj$2oveh$1@dont-email.me...
...
> I wonder why the float list aggregate isn't inferred by the compiler and
> need some help with a qualification.
The language rule is that the ancestor_part of an extension aggregate is
expected to be of "any tagged type" (see 4.3.2(4/2)). An aggregate needs to
have a single specific type, and "any tagged type" is not that.
The reason that the ancestor is "any tagged type" is that the type of the
ancestor determines the extension components needed along with other
legality rules. One could imagine a language where all of these things are
decided simulateously, but people worried that the complexity would make it
difficult/impossible to implement. So aggregates are essentially black boxes
whose type has to be determinable from the outside, and similar rules exist
for parts inside the aggregate.
Randy.
"Jeffrey R.Carter" <spam.jrcarter.not@spam.acm.org.not> writes:
[...]
> can only be compiled with GNAT. Note that, unlike
> PragmARC.Unbounded_Numbers.Integers, GNAT's implementation of
> Ada.Numerics.Big_Numbers.Big_Integers is not truly unbounded. I don't
> know if it will hold 101 ** 101 without modification.
It only has to hold 100 ** 100. The Python code in the parent uses the
expression `range(2,101)`. Python's range() function yields a range
that includes the first bound and excludes the second bound.
--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */
On 2023-09-15 11:03, CSYH (QAQ) wrote: > As I know integer type is for 32 bits. but for this problem as me to find out the 2 ** 100 and even 100 ** 100. I missed this the first time. No, you don't know that Integer is 32 bits. ARM 3.5.4 (21) [http://www.ada-auth.org/standards/aarm12_w_tc1/html/AA-3-5-4.html] requires "In an implementation, the range of Integer shall include the range –2**15+1 .. +2**15–1." There are compilers for which Integer is less than 32 bits, so assuming otherwise is not portable. I know a lot of people don't care about portability, but I've also seen projects that spent large sums porting code that they thought didn't have to be portable. The cost of writing portable code is usually much smaller than the cost of porting non-portable code. Of course, you can always declare your own integer type with whatever range is appropriate for your problem, though the compiler doesn't always have to accept it. I don't know any compiler that doesn't accept 32-bit integer declarations, nor any targeting 64-bit platforms that doesn't accept 64-bit integers. But you're unlikely to find a compiler that will accept range 2 .. 101 ** 101 In King (https://github.com/jrcarter/King) the compiler must accept all integer type declarations. -- Jeff Carter "I didn't squawk about the steak, dear. I merely said I didn't see that old horse that used to be tethered outside here." Never Give a Sucker an Even Break 103
"CSYH (QAQ)" <schen309@asu.edu> writes:
> Now this time, I am facing trouble for problem #29. As I know integer
> type is for 32 bits. but for this problem as me to find out the 2 **
> 100 and even 100 ** 100. I used python to get the answer correctly in
> 5 minutes.
>
> context = []
> for a in range(2,101):
> for b in range(2,101):
> context.append(a**b)
> len(list(set(context)))
>
> I know the algorithm is easy, but I am pretty interesting how to
> calculate a large like it.
Most of the Project Euler problems have solutions that are not always
the obvious one (though sometimes the obvious one is the best). You
can, of course, just use a big number type (or write your own!) but this
problem can be solved without having to use any large numbers at all.
--
Ben.
On 2023-09-15 11:03, CSYH (QAQ) wrote: > > for this problem I want to know how to know is there an easy way to store a large number like 100 ** 100, and how do U make a similar function like "set(context)" to delete the duplicated value in a vector. You will need an unbounded-integer pkg. If you want to write portable code in a standard language, then you can write Ada 12 using a library such as PragmARC.Unbounded_Numbers.Integers (https://github.com/jrcarter/PragmARC/blob/Ada-12/pragmarc-unbounded_numbers-integers.ads). This will compile with both GNAT and ObjectAda. If you want to write non-portable code in a non-standard, Ada-like language, then you can use the GNAT language, which is mostly Ada 12 with some Ada 23 features, one of which is the Ada-23 standard package Ada.Numerics.Big_Numbers.Big_Integers (http://www.ada-auth.org/standards/22aarm/html/AA-A-5-6.html). This can only be compiled with GNAT. Note that, unlike PragmARC.Unbounded_Numbers.Integers, GNAT's implementation of Ada.Numerics.Big_Numbers.Big_Integers is not truly unbounded. I don't know if it will hold 101 ** 101 without modification. You can store the results directly in a set from the standard library to avoid duplicate values. If I understand your Python (probably not), you would want to output the result of Length for the resulting set. -- Jeff Carter "I didn't squawk about the steak, dear. I merely said I didn't see that old horse that used to be tethered outside here." Never Give a Sucker an Even Break 103
On Thursday, September 7, 2023 at 3:31:12 PM UTC+8, Francesc Rocher wrote:
> El dia dilluns, 4 de setembre de 2023 a les 11:19:53 UTC+2, CSYH (QAQ) va escriure:
> > I am new to Ada, I know is there a good way to start this program?
> > thanks
> > https://projecteuler.net/problem=26
> Hi CSHY,
>
> Please take a look at my Euler tools repository, https://github.com/rocher/euler_tools (not the best math lib you'll find, I know).
> I used this library tools to solve problem 26 here: https://github.com/rocher/alice-project_euler-rocher
> Let me know what you think.
sorry for reply so late. I just do not know how to install the lib to my GNAT.
Hello, everyone. Now this time, I am facing trouble for problem #29. As I know integer type is for 32 bits. but for this problem as me to find out the 2 ** 100 and even 100 ** 100. I used python to get the answer correctly in 5 minutes. context = [] for a in range(2,101): for b in range(2,101): context.append(a**b) len(list(set(context))) I know the algorithm is easy, but I am pretty interesting how to calculate a large like it. And thanks for the help from problem 26, your discussions come my every working hour. for this problem I want to know how to know is there an easy way to store a large number like 100 ** 100, and how do U make a similar function like "set(context)" to delete the duplicated value in a vector. Thanks From CSYH(QAQ)
tirsdag 12. september 2023 kl. 09:16:56 UTC+2 skrev Stéphane Rivière: > > Did mean ...... *gnoga* (as compared to for example guacamole apache) :-) > No, sorry, I was thinking more of Guacamole. Not really fond of a remote > desktop vs a true Web app... But maybe I'm wrong... > -- > Stéphane Rivière > Ile d'Oléron - France Related: Anybody heard about Ada programs available under rollApps (https://www.rollapp.com/) and similar? Reviews: https://slashdot.org/software/p/rollApp/#reviews reinert
Le 14/09/2023 à 23:37, Jeffrey R.Carter a écrit :
> On 2023-09-14 22:00, Blady wrote:
>>
>> I wonder why the float list aggregate isn't inferred by the compiler
>> and need some help with a qualification.
>
> I'm not sure. But can't you simply write
>
> ML2 : My_Float_List2 := [-3.1, -6.7, 3.3, -3.14, 0.0];
>
> ? I presume that My_Float_List2 inherits its aggregate definition from
> My_Float_List1.
Unfortunately not directly:
10. ML2c : My_Float_List2 := [-3.1, -6.7, 3.3, -3.14, 0.0];
|
>>> error: type of aggregate has private ancestor "Vector"
>>> error: must use extension aggregate
Shouldn't inherit them?
Indeed you have it if you defined a private extension with explicit aspects:
package PA is
type My_Float_List3 is new My_Float_Lists.Vector with private with
Constant_Indexing => Constant_Reference,
Variable_Indexing => Reference,
Default_Iterator => Iterate,
Iterator_Element => Float,
Aggregate =>
(Empty => Empty, Add_Unnamed => Append, New_Indexed =>
New_Vector, Assign_Indexed => Replace_Element);
function Constant_Reference
(Container : aliased My_Float_List3; Index : Positive) return
My_Float_Lists.Constant_Reference_Type is
(My_Float_Lists.Constant_Reference (My_Float_Lists.Vector
(Container), Index));
function Reference (Container : aliased in out My_Float_List3;
Index : Positive) return My_Float_Lists.Reference_Type is
(My_Float_Lists.Reference (My_Float_Lists.Vector (Container),
Index));
private
type My_Float_List3 is new My_Float_Lists.Vector with null record;
end PA;
ML3 : PA.My_Float_List3 := [-3.1, -6.7, 3.3, -3.14, 0.0];
On 2023-09-14 22:00, Blady wrote:
>
> I wonder why the float list aggregate isn't inferred by the compiler and need
> some help with a qualification.
I'm not sure. But can't you simply write
ML2 : My_Float_List2 := [-3.1, -6.7, 3.3, -3.14, 0.0];
? I presume that My_Float_List2 inherits its aggregate definition from
My_Float_List1.
--
Jeff Carter
"[M]any were collected near them, ... to
enjoy the sight of a dead young lady, nay,
two dead young ladies, for it proved twice
as fine as the first report."
Persuasion
155
Le 14/09/2023 à 17:31, Jeffrey R.Carter a écrit :
> On 2023-09-14 16:02, Blady wrote:
>>
>> 1. with Ada.Containers.Vectors;
>> 2. with Ada.Text_IO;
>> 3. procedure test_20230914_derived_agg is
>> 4. package My_Float_Lists is new Ada.Containers.Vectors
>> (Positive, Float);
>> 5. subtype My_Float_List1 is My_Float_Lists.Vector;
>> 6. type My_Float_List2 is new My_Float_Lists.Vector with null
>> record;
>> 7. ML1 : My_Float_List1 := [-3.1, -6.7, 3.3, -3.14, 0.0];
>> 8. ML2 : My_Float_List2 := ([-3.1, -6.7, 3.3, -3.14, 0.0]
>> with null record);
>> |
>> >>> error: no unique type for this aggregate
>
> IIUC, you have to qualify the value:
>
> (My_Float_List1'[-3.1, -6.7, 3.3, -3.14, 0.0] with null record)
>
> or
>
> (My_Float_Lists.Vector'[-3.1, -6.7, 3.3, -3.14, 0.0] with null record)
>
> (not tested)
Thanks Jeff, both proposals are compiled ok by GNAT.
I wonder why the float list aggregate isn't inferred by the compiler and
need some help with a qualification.
On 2023-09-14 16:02, Blady wrote:
>
> 1. with Ada.Containers.Vectors;
> 2. with Ada.Text_IO;
> 3. procedure test_20230914_derived_agg is
> 4. package My_Float_Lists is new Ada.Containers.Vectors (Positive, Float);
> 5. subtype My_Float_List1 is My_Float_Lists.Vector;
> 6. type My_Float_List2 is new My_Float_Lists.Vector with null record;
> 7. ML1 : My_Float_List1 := [-3.1, -6.7, 3.3, -3.14, 0.0];
> 8. ML2 : My_Float_List2 := ([-3.1, -6.7, 3.3, -3.14, 0.0] with null
> record);
> |
> >>> error: no unique type for this aggregate
IIUC, you have to qualify the value:
(My_Float_List1'[-3.1, -6.7, 3.3, -3.14, 0.0] with null record)
or
(My_Float_Lists.Vector'[-3.1, -6.7, 3.3, -3.14, 0.0] with null record)
(not tested)
--
Jeff Carter
"[M]any were collected near them, ... to
enjoy the sight of a dead young lady, nay,
two dead young ladies, for it proved twice
as fine as the first report."
Persuasion
155
"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes: ... I feel it's time to draw this to a close, so I'll just say thank you for your time. I didn't want you to think I hadn't read your post, but I think we're starting to repeat ourselves. The only new technical matters were some questions about ML's type system and that would be getting very far off-topic for this group. I always enjoy getting a different perspective on such topics. I hope you do to. -- Ben.
Hello, I want to extend a container type like Vectors, I've written: type My_Float_List2 is new My_Float_Lists.Vector with null record; But the initialization gives an error line 6: 1. with Ada.Containers.Vectors; 2. with Ada.Text_IO; 3. procedure test_20230914_derived_agg is 4. package My_Float_Lists is new Ada.Containers.Vectors (Positive, Float); 5. subtype My_Float_List1 is My_Float_Lists.Vector; 6. type My_Float_List2 is new My_Float_Lists.Vector with null record; 7. ML1 : My_Float_List1 := [-3.1, -6.7, 3.3, -3.14, 0.0]; 8. ML2 : My_Float_List2 := ([-3.1, -6.7, 3.3, -3.14, 0.0] with null record); | >>> error: no unique type for this aggregate 9. begin 10. Ada.Text_IO.Put_Line (ML1.Element (3)'Image); 11. Ada.Text_IO.Put_Line (ML2.Element (3)'Image); 12. end test_20230914_derived_agg; The RM says: 4.3.2 Extension Aggregates 1 [An extension_aggregate specifies a value for a type that is a record extension by specifying a value or subtype for an ancestor of the type, followed by associations for any components not determined by the ancestor_part.] Language Design Principles 1.a The model underlying this syntax is that a record extension can also be viewed as a regular record type with an ancestor "prefix". The record_component_association_list corresponds to exactly what would be needed if there were no ancestor/prefix type. The ancestor_part determines the value of the ancestor/prefix. Syntax 2 extension_aggregate ::= (ancestor_part with record_component_association_list) 3 ancestor_part ::= expression | subtype_mark It is not so clear for me what could a unique type? Any clue? Thanks Pascal.
On 2023-09-13 14:24, Ben Bacarisse wrote: > "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes: > >> On 2023-09-11 18:13, Ben Bacarisse wrote: >>> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes: > >>>> You should think about whether storing >>>> represents an issue, e.g. in terms of performance and/or space. If it does >>>> you should consider suitable implementation of storage that provides >>>> required overall performance of needed operations, like insertion, search, >>>> cleaning up etc. >>> >>> Yes, in Ada. Since I can't use universal algorithms, it pays to decide >>> all this first because changes will be costly. >> >> There are no universally applicable algorithms. > > This may be just a case where we are using terms to refer to different > things. I find it hard to believe you don't know what I am referring to > since we've had a productive exchange examining an example in detail, > but I can agree it's not a good term. I simply could not come up with a > better one on the fly. > > So I'll re-phrase it avoiding the disputed term: simple fibledychops are > not available to the Ada programmer, but they are available in some > other languages. I suspect you are not interested in what simple > fibledychops are, since their absence from Ada means they are not of any > importance (and may even be, in your opinion, detrimental to writing > good programs). If you really want to know what a fibledychop is, I can > have a go at saying more about what they it, but would that be > worthwhile? I think you are sure they are a bad idea already. Each language feature has a purpose. Roughly it is called language paradigm: how routine programming activities are approached when using the language. Ada's paradigm is different from what you expect. E.g. sunroof might be a simple car feature, but a submarine user would not be impressed. >>>> My understanding was that you wanted to see how to use the Ada standard >>>> library containers with generics. >>> >>> Well that's what it turned out to be. At first I did not know that >>> built-in types like arrays can't be covered in the same way. >> >> I know no language where primitive built-in types may have classes. > > Haskell's type classes are very nice -- every type belongs to one or > more classes that determine the permitted operations. No difference to Ada. Integer belongs to an integer class and there is a formal generic type for the class members. The problem I am talking about is that there is no run-time objects of and no non-integer type can be put in that class. > In ML for example, > the interface to arrays is defined in ML so they can support a universal > set of operations shared with many other types, but they are usually > implemented by the run-time environment for speed. Can I take integer type, derive a new *integer* type from it such that it would also implement an array interface? So that I could access integer decimal digits? Or use your "fibledychops" with on it? This is impossible in Ada. Which is in particular why Ada ordered containers do not implement array interface. They simply cannot. Ada has a generic array interface declared as generic type Index_Type is ... type Element_Type is ... type Array_Type is array (Index_Type range <>) of Element_Type; but even that is not implementable by anything except by a proper array. Yes, there is an ugly iterator hack Georg mentioned in another thread. The hack allows containers to *look* like arrays in syntax, e.g. you can loop and index a container this way. This is possibly what you meant referencing ML. But I do not know ML. >>> What matters is what types the >>> language offers, and what the interfaces to those types are. >> >> That does not matter at all. Matters the type algebra by which programmer >> can create types suitable to model the problem space entities. > > Yes, but... First, almost every language comes with some predefined > types. If the problem space needs fast indexed access to a set of > entities, we don't usually have to define our own arrays or vectors. Index and element types always same? When I derive a new type from the array element type, would an array of such elements related to an array of base element type? Can I control the decision? Can I have an array of elements from both element types? How such arrays are related to the specific element type arrays. Then add the index types hierarchy to the picture... You would say: uninterested. So I am in "fibledychops"... (:-)) > Secondly, the problem space > has two components -- data and actions on that data. I suspect by > "problem space entities" you mean just the data because that what Ada > focuses on. No, in Ada it is both. You can add "free functions" as you wish, anytime, anywhere. It is the classes and their primitive operations (AKA methods) that pose problems. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
Le 13/09/2023 à 21:23, Gautier write-only address a écrit :
> Le mardi 30 mai 2023 à 08:03:22 UTC+2, DrPi a écrit :
>> That's it. Auto-completion and mouse-over documentation in LEA.
>
> Some news: mouse-over documentation is implemented, as well as a "go to declaration" context menu entry :-)
That's great news :)
Hello everybody! I would like to announce the October Ada Monthly Meetup which will be taking place on the 7th of October at 13:00 UTC time (15:00 CET). As always the meetup will take place over at Jitsi. Hopefully this time I will not have the same amount of technical issues… If someone would like to propose a talk or a topic, feel free to do so! I will be talking about FOSDEM, but only for a couple of minutes, since the dates have already been announced (the same as every year, first weekend of February). Here are the connection details from previous posts: The meetup will take place over at Jitsi, a conferencing software that runs on any modern browser. The link is [1]. The room name is “AdaMonthlyMeetup” and in case it asks for a password, it will be set to “AdaRules”. I do not want to set up a password, but in case it is needed, it will be the one above without the quotes. The room name is generally not needed as the link should take you directly there, but I want to write it down just in case someone needs it. [1] https://meet.jit.si/AdaMonthlyMeetup Best regards and see you soon! Fer
Le mardi 30 mai 2023 à 08:03:22 UTC+2, DrPi a écrit :
> That's it. Auto-completion and mouse-over documentation in LEA.
Some news: mouse-over documentation is implemented, as well as a "go to declaration" context menu entry :-)
"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes: > On 2023-09-11 18:13, Ben Bacarisse wrote: >> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes: >>> You should think about whether storing >>> represents an issue, e.g. in terms of performance and/or space. If it does >>> you should consider suitable implementation of storage that provides >>> required overall performance of needed operations, like insertion, search, >>> cleaning up etc. >> >> Yes, in Ada. Since I can't use universal algorithms, it pays to decide >> all this first because changes will be costly. > > There are no universally applicable algorithms. This may be just a case where we are using terms to refer to different things. I find it hard to believe you don't know what I am referring to since we've had a productive exchange examining an example in detail, but I can agree it's not a good term. I simply could not come up with a better one on the fly. So I'll re-phrase it avoiding the disputed term: simple fibledychops are not available to the Ada programmer, but they are available in some other languages. I suspect you are not interested in what simple fibledychops are, since their absence from Ada means they are not of any importance (and may even be, in your opinion, detrimental to writing good programs). If you really want to know what a fibledychop is, I can have a go at saying more about what they it, but would that be worthwhile? I think you are sure they are a bad idea already. >>> My understanding was that you wanted to see how to use the Ada standard >>> library containers with generics. >> >> Well that's what it turned out to be. At first I did not know that >> built-in types like arrays can't be covered in the same way. > > I know no language where primitive built-in types may have classes. Haskell's type classes are very nice -- every type belongs to one or more classes that determine the permitted operations. And in some languages there are essentially no "built-in" types. In ML for example, the interface to arrays is defined in ML so they can support a universal set of operations shared with many other types, but they are usually implemented by the run-time environment for speed. >> What matters is what types the >> language offers, and what the interfaces to those types are. > > That does not matter at all. Matters the type algebra by which programmer > can create types suitable to model the problem space entities. Yes, but... First, almost every language comes with some predefined types. If the problem space needs fast indexed access to a set of entities, we don't usually have to define our own arrays or vectors. It's so often needed that we expect something to be provided, so what types the language offers /does/ matter. Secondly, the problem space has two components -- data and actions on that data. I suspect by "problem space entities" you mean just the data because that what Ada focuses on. But programming languages can offer tool that help to model the actions in the problem space as well. -- Ben.
On 2023-09-11 18:13, Ben Bacarisse wrote: > "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes: > >> On 2023-09-10 21:22, Ben Bacarisse wrote: >>> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes: >> You should think about whether storing >> represents an issue, e.g. in terms of performance and/or space. If it does >> you should consider suitable implementation of storage that provides >> required overall performance of needed operations, like insertion, search, >> cleaning up etc. > > Yes, in Ada. Since I can't use universal algorithms, it pays to decide > all this first because changes will be costly. There are no universally applicable algorithms. > But in some other > languages I can try various schemes and measure or profile to see what > time/space trade-offs there are between different designs. So you can in Ada. > This is > easiest when I don't have to worry about all the changes that simply > switching from, say, a list to an array will incur. Measuring performance is not a simple task. Switching from the visitor pattern to loop is your least problem. >>> But the conclusion seems to be that maximising over any container is >>> just too simple to be worth making it a reusable component in Ada. And >>> even then it would not (as far as I can tell) work for native arrays. >> >> You do not need *any* container. You need a container, just one. > > Yes, in Ada. The cost of changing a design is going to be > non-negligible, so we must make sure you get it right before too much > code is written. Right, because in that case you would have some non-trivial issue. So it would take much more efforts than merely calling a different function. There is an inherent difference between dealing with real size and complexity projects and hobby examples like this puzzle. The overhead you get from Ada pays off in programming en large. That was intentional language design. >>> It would be a shame if something I said >>> has ended up causing you to propose solutions you don't think are the >>> best ones for this example. >> >> My understanding was that you wanted to see how to use the Ada standard >> library containers with generics. > > Well that's what it turned out to be. At first I did not know that > built-in types like arrays can't be covered in the same way. I know no language where primitive built-in types may have classes. That is the major problem with type systems that they have first, second and third class citizens. Ada arrays (and fixed strings) are in a different basket than containers. >> Generic programming in Ada (programming in terms of sets of types) is a >> huge, almost infinite topic. One should be rather specific. > > Sorry. I was hoping that generalising from a range to an array or some > other container would not be the huge topic it turned out to be. Unfortunately it is, because nobody knows how to design a type system where proper arrays, that is one you could pass to a system library function written in C, can be dealt with in the same manner as a container in some polymorphic body. A mainstream choice is not to have proper arrays in the language at all. Then, logically, just forget that they exist in Ada. Problem solved! >>>> In Ada you have freedom to choose your way, which also massively reduces >>>> universality of any abstraction, which will never apply universally. >>> That's a strange remark. You have to do things the Ada way. The >>> freedom is only in choosing how to combine the specific tools in Ada's >>> toolbox, and Ada also constrains how the tools can be combined. >> >> There are more than one way to skin a cat in Ada. You can choose one drawer >> in the Ada toolbox and feel comfortable with what it provides all your >> life. >> >> "Ada way" among Ada users rather refers to an approach to software >> engineering in general. Like upfront specification, separation and careful >> design of interfaces, modular design, problem space driven choice of types, >> earliest possible error detection etc. > > Yes, I remember the 80s! It's rare to have specifications that don't > change these days. I remember a book on structured programming from 80's describing exactly the way programs are written today as an example how projects are doomed to fail. As I said, Dark Ages. > And general remarks like "problem space driven > choice of types" apply to all languages. In most languages there is no choice because all scalar types are predefined. > What matters is what types the > language offers, and what the interfaces to those types are. That does not matter at all. Matters the type algebra by which programmer can create types suitable to model the problem space entities. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
> Did mean ...... *gnoga* (as compared to for example guacamole apache) :-)
No, sorry, I was thinking more of Guacamole. Not really fond of a remote
desktop vs a true Web app... But maybe I'm wrong...
--
Stéphane Rivière
Ile d'Oléron - France
mandag 11. september 2023 kl. 09:52:49 UTC+2 skrev Stéphane Rivière:
> Hi Reinert,
> > Sounds like I can somehow trust that gnoga will be around many years to come.
> I think so.
> > So my special issue: I work on making my (cancer) cellular behavior analysis program (https://korsnesbiocomputing.no/) as a "cloud service".
> Very interesting indeed.
>
> >Its all programmed in Ada using GLOBE_3D. I consider using guacamole apache. Its intensive about handling images. So what are the aguments for and against using >guaceamole (as compared to for example guacamole apache) ?
>
> No idea. My first concerns could be scaling.
> --
> Stéphane Rivière
> Ile d'Oléron - France
Did mean ...... *gnoga* (as compared to for example guacamole apache) :-)
"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes: > On 2023-09-10 21:22, Ben Bacarisse wrote: >> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes: >> >>> On 2023-09-10 03:20, Ben Bacarisse wrote: >>>> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes: >>>> >>>>> On 2023-09-09 02:25, Ben Bacarisse wrote: >>>>>> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes: >> >>>>>>> As I said you think in a wrong direction of abstracting the language >>>>>>> "finding maximum" rather than the problem space, e.g. generalization to >>>>>>> other bases, other mathematical structures etc. >>>>>> Generalising to an arbitrary base is local to the function that finds >>>>>> the answer for one element. It's an entirely separate axis of >>>>>> generalisation to that of where the elements come from. >>>>>> It's interesting to me that you consider one simply wrong and the other >>>>>> natural. >>>>> >>>>> Because one is a software design artifact and another is the result of >>>>> problem space analysis. >>>> Which one the wrong one? >>> >>> None automatically is. The point is avoiding overdesigning a numeric >>> puzzle. >> Ah, I thought your criticise was intended to be general -- that >> "abstracting the language 'finding maximum' rather than the problem >> space" was always wrong, but it seems you meant only in the case of a >> puzzle like this. Numeric puzzles like this should only be generalised >> in a few "approved" directions? > > Yes, in the direction of numeric problem space. Universal finding maximum > is another problem space, e.g. a container library design etc. Noted! I will try to guess what generalisations you might approve of in future :-) >> Since prime numbers are crucial here, I had already tried a couple of >> prime sieves in one of my solutions. In that Ada solution, I would >> probably have to store the primes somewhere and maximise over that. >> That's what got me thinking about a general "maximise F over X" function >> because if Ada had a simple way to do that, I could try various ways to >> write the sieve -- the primes might end up in an array, a set or a map, >> and it would make no difference to the rest of the code. > > And this is exactly wrong. In Ada. It works well in some other languages for reasons I'll explain just below. > You should think about whether storing > represents an issue, e.g. in terms of performance and/or space. If it does > you should consider suitable implementation of storage that provides > required overall performance of needed operations, like insertion, search, > cleaning up etc. Yes, in Ada. Since I can't use universal algorithms, it pays to decide all this first because changes will be costly. But in some other languages I can try various schemes and measure or profile to see what time/space trade-offs there are between different designs. This is easiest when I don't have to worry about all the changes that simply switching from, say, a list to an array will incur. >> But the conclusion seems to be that maximising over any container is >> just too simple to be worth making it a reusable component in Ada. And >> even then it would not (as far as I can tell) work for native arrays. > > You do not need *any* container. You need a container, just one. Yes, in Ada. The cost of changing a design is going to be non-negligible, so we must make sure you get it right before too much code is written. >>> [...] >>>> This is probably the closest we can get to a universal solution. >>>> Vectors don't have a Key function but I am sure I could find out what >>>> should be provided there. >>> >>> Vector has To_Index for Key. >>> >>> In general, note that Ada does not require you to use any library. I >>> personally dislike cursors in particular because of their "functional" >>> style. I prefer plain element position and loop iteration of ordered >>> structures. A container library based on this paradigm would use other >>> generic abstraction. >>> >>> Furthermore, I prefer dynamic polymorphism of tagged types over parametric >>> one of generics. Therefore to me Maximum_At should rather be a class-wide >>> or primitive operation than a generic. >> I was looking for whatever design you thought best, since you know Ada >> infinitely better that I do. > > The best design is plain loop. Yes, in Ada. >> It would be a shame if something I said >> has ended up causing you to propose solutions you don't think are the >> best ones for this example. > > My understanding was that you wanted to see how to use the Ada standard > library containers with generics. Well that's what it turned out to be. At first I did not know that built-in types like arrays can't be covered in the same way. > Generic programming in Ada (programming in terms of sets of types) is a > huge, almost infinite topic. One should be rather specific. Sorry. I was hoping that generalising from a range to an array or some other container would not be the huge topic it turned out to be. >>> In Ada you have freedom to choose your way, which also massively reduces >>> universality of any abstraction, which will never apply universally. >> That's a strange remark. You have to do things the Ada way. The >> freedom is only in choosing how to combine the specific tools in Ada's >> toolbox, and Ada also constrains how the tools can be combined. > > There are more than one way to skin a cat in Ada. You can choose one drawer > in the Ada toolbox and feel comfortable with what it provides all your > life. > > "Ada way" among Ada users rather refers to an approach to software > engineering in general. Like upfront specification, separation and careful > design of interfaces, modular design, problem space driven choice of types, > earliest possible error detection etc. Yes, I remember the 80s! It's rare to have specifications that don't change these days. And general remarks like "problem space driven choice of types" apply to all languages. What matters is what types the language offers, and what the interfaces to those types are. >>> I would like to have means to deal with this problem by means of ad-hoc >>> supertypes, but that will never happen due to lack of interest in reworking >>> the language type system and because in "Dark Ages" there is virtually no >>> research on fundamental language construction topics. >> I don't believe that to be the case. I can believe that there is little >> research into overhauling Ada's type system, but not in general. > > I am not aware of any substantial contributions since Cardelli > etc. Recently designed languages represent a pitiful mess of old wrong > ideas in an ongoing competition to create something more flawed than K&R > C... Forgive me, but that does not appear to be a well-informed option. You may be bang up to date as far as research into programming language type systems is concerned, but that reply does no read as if it were written by someone who is. -- Ben.
Hi Reinert, > Sounds like I can somehow trust that gnoga will be around many years to come. I think so. > So my special issue: I work on making my (cancer) cellular behavior analysis program (https://korsnesbiocomputing.no/) as a "cloud service". Very interesting indeed. >Its all programmed in Ada using GLOBE_3D. I consider using guacamole apache. Its intensive about handling images. So what are the aguments for and against using >guaceamole (as compared to for example guacamole apache) ? No idea. My first concerns could be scaling. -- Stéphane Rivière Ile d'Oléron - France
On 2023-09-10 21:22, Ben Bacarisse wrote: > "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes: > >> On 2023-09-10 03:20, Ben Bacarisse wrote: >>> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes: >>> >>>> On 2023-09-09 02:25, Ben Bacarisse wrote: >>>>> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes: > >>>>>> As I said you think in a wrong direction of abstracting the language >>>>>> "finding maximum" rather than the problem space, e.g. generalization to >>>>>> other bases, other mathematical structures etc. >>>>> Generalising to an arbitrary base is local to the function that finds >>>>> the answer for one element. It's an entirely separate axis of >>>>> generalisation to that of where the elements come from. >>>>> It's interesting to me that you consider one simply wrong and the other >>>>> natural. >>>> >>>> Because one is a software design artifact and another is the result of >>>> problem space analysis. >>> Which one the wrong one? >> >> None automatically is. The point is avoiding overdesigning a numeric >> puzzle. > > Ah, I thought your criticise was intended to be general -- that > "abstracting the language 'finding maximum' rather than the problem > space" was always wrong, but it seems you meant only in the case of a > puzzle like this. Numeric puzzles like this should only be generalised > in a few "approved" directions? Yes, in the direction of numeric problem space. Universal finding maximum is another problem space, e.g. a container library design etc. > Since prime numbers are crucial here, I had already tried a couple of > prime sieves in one of my solutions. In that Ada solution, I would > probably have to store the primes somewhere and maximise over that. > That's what got me thinking about a general "maximise F over X" function > because if Ada had a simple way to do that, I could try various ways to > write the sieve -- the primes might end up in an array, a set or a map, > and it would make no difference to the rest of the code. And this is exactly wrong. You should think about whether storing represents an issue, e.g. in terms of performance and/or space. If it does you should consider suitable implementation of storage that provides required overall performance of needed operations, like insertion, search, cleaning up etc. > But the conclusion seems to be that maximising over any container is > just too simple to be worth making it a reusable component in Ada. And > even then it would not (as far as I can tell) work for native arrays. You do not need *any* container. You need a container, just one. >> [...] >>> This is probably the closest we can get to a universal solution. >>> Vectors don't have a Key function but I am sure I could find out what >>> should be provided there. >> >> Vector has To_Index for Key. >> >> In general, note that Ada does not require you to use any library. I >> personally dislike cursors in particular because of their "functional" >> style. I prefer plain element position and loop iteration of ordered >> structures. A container library based on this paradigm would use other >> generic abstraction. >> >> Furthermore, I prefer dynamic polymorphism of tagged types over parametric >> one of generics. Therefore to me Maximum_At should rather be a class-wide >> or primitive operation than a generic. > > I was looking for whatever design you thought best, since you know Ada > infinitely better that I do. The best design is plain loop. > It would be a shame if something I said > has ended up causing you to propose solutions you don't think are the > best ones for this example. My understanding was that you wanted to see how to use the Ada standard library containers with generics. Generic programming in Ada (programming in terms of sets of types) is a huge, almost infinite topic. One should be rather specific. >> In Ada you have freedom to choose your way, which also massively reduces >> universality of any abstraction, which will never apply universally. > > That's a strange remark. You have to do things the Ada way. The > freedom is only in choosing how to combine the specific tools in Ada's > toolbox, and Ada also constrains how the tools can be combined. There are more than one way to skin a cat in Ada. You can choose one drawer in the Ada toolbox and feel comfortable with what it provides all your life. "Ada way" among Ada users rather refers to an approach to software engineering in general. Like upfront specification, separation and careful design of interfaces, modular design, problem space driven choice of types, earliest possible error detection etc. >> I would like to have means to deal with this problem by means of ad-hoc >> supertypes, but that will never happen due to lack of interest in reworking >> the language type system and because in "Dark Ages" there is virtually no >> research on fundamental language construction topics. > > I don't believe that to be the case. I can believe that there is little > research into overhauling Ada's type system, but not in general. I am not aware of any substantial contributions since Cardelli etc. Recently designed languages represent a pitiful mess of old wrong ideas in an ongoing competition to create something more flawed than K&R C... -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes: > On 2023-09-10 03:20, Ben Bacarisse wrote: >> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes: >> >>> On 2023-09-09 02:25, Ben Bacarisse wrote: >>>> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes: >>>>> As I said you think in a wrong direction of abstracting the language >>>>> "finding maximum" rather than the problem space, e.g. generalization to >>>>> other bases, other mathematical structures etc. >>>> Generalising to an arbitrary base is local to the function that finds >>>> the answer for one element. It's an entirely separate axis of >>>> generalisation to that of where the elements come from. >>>> It's interesting to me that you consider one simply wrong and the other >>>> natural. >>> >>> Because one is a software design artifact and another is the result of >>> problem space analysis. >> Which one the wrong one? > > None automatically is. The point is avoiding overdesigning a numeric > puzzle. Ah, I thought your criticise was intended to be general -- that "abstracting the language 'finding maximum' rather than the problem space" was always wrong, but it seems you meant only in the case of a puzzle like this. Numeric puzzles like this should only be generalised in a few "approved" directions? Obviously I disagree. I would probably not bother doing this sort of puzzle if it did not spark thoughts that go well beyond getting the answer and a few obvious variation like using a different base. Because I am interested in programming languages in general I always solve such puzzles in more than one language so I can see how well they express the algorithms involved. Since prime numbers are crucial here, I had already tried a couple of prime sieves in one of my solutions. In that Ada solution, I would probably have to store the primes somewhere and maximise over that. That's what got me thinking about a general "maximise F over X" function because if Ada had a simple way to do that, I could try various ways to write the sieve -- the primes might end up in an array, a set or a map, and it would make no difference to the rest of the code. But the conclusion seems to be that maximising over any container is just too simple to be worth making it a reusable component in Ada. And even then it would not (as far as I can tell) work for native arrays. > [...] >> This is probably the closest we can get to a universal solution. >> Vectors don't have a Key function but I am sure I could find out what >> should be provided there. > > Vector has To_Index for Key. > > In general, note that Ada does not require you to use any library. I > personally dislike cursors in particular because of their "functional" > style. I prefer plain element position and loop iteration of ordered > structures. A container library based on this paradigm would use other > generic abstraction. > > Furthermore, I prefer dynamic polymorphism of tagged types over parametric > one of generics. Therefore to me Maximum_At should rather be a class-wide > or primitive operation than a generic. I was looking for whatever design you thought best, since you know Ada infinitely better that I do. It would be a shame if something I said has ended up causing you to propose solutions you don't think are the best ones for this example. > In Ada you have freedom to choose your way, which also massively reduces > universality of any abstraction, which will never apply universally. That's a strange remark. You have to do things the Ada way. The freedom is only in choosing how to combine the specific tools in Ada's toolbox, and Ada also constrains how the tools can be combined. This is true for any programming language. None of then give you the freedom choose your way unless your way already aligns with what it permitted! > I would like to have means to deal with this problem by means of ad-hoc > supertypes, but that will never happen due to lack of interest in reworking > the language type system and because in "Dark Ages" there is virtually no > research on fundamental language construction topics. I don't believe that to be the case. I can believe that there is little research into overhauling Ada's type system, but not in general. -- Ben.
On 2023-09-09 10:13, G.B. wrote: > The "apparatus" that the computation needs in order to remember > "max so far" looks like part of its state to me. Somehow > "the function" needs to operate this state and evaluate it. You can hide explicit state using recursion. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
On 2023-09-10 03:20, Ben Bacarisse wrote: > "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes: > >> On 2023-09-09 02:25, Ben Bacarisse wrote: >>> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes: > >>>> [rant on] >>>> An Ada programmer would just write a loop. >>> Yes, that's fine. Different languages have different objectives. Just >>> write the empty range test and the loop you need for each kind of >>> collection. >> >> You can loop in Ada over empty ranges, no problem. > > Yes, but the problem in hand (maximum of F over X) should raise an error > on an empty X. I know there are other options, but you chose to > raise an error so that's the design I was talking about. It can be done by a Boolean flag. >>> That was definitely the way things were done in the 80s. >> >> Yes, before the Dark Ages of Computing... > > Eh? There have been repeated updates to the Ada language. Are they > taking Ada into the dark ages? If so, what was the golden age of Ada > when its design was perfect for numerical algorithms? I meant the state of computing as a whole. (Ada is a niche language and "hordes of barbarians" largely missed its existence... (:-)) >>>> As I said you think in a wrong direction of abstracting the language >>>> "finding maximum" rather than the problem space, e.g. generalization to >>>> other bases, other mathematical structures etc. >>> Generalising to an arbitrary base is local to the function that finds >>> the answer for one element. It's an entirely separate axis of >>> generalisation to that of where the elements come from. >>> It's interesting to me that you consider one simply wrong and the other >>> natural. >> >> Because one is a software design artifact and another is the result of >> problem space analysis. > > Which one the wrong one? None automatically is. The point is avoiding overdesigning a numeric puzzle. [...] > This is probably the closest we can get to a universal solution. > Vectors don't have a Key function but I am sure I could find out what > should be provided there. Vector has To_Index for Key. In general, note that Ada does not require you to use any library. I personally dislike cursors in particular because of their "functional" style. I prefer plain element position and loop iteration of ordered structures. A container library based on this paradigm would use other generic abstraction. Furthermore, I prefer dynamic polymorphism of tagged types over parametric one of generics. Therefore to me Maximum_At should rather be a class-wide or primitive operation than a generic. In Ada you have freedom to choose your way, which also massively reduces universality of any abstraction, which will never apply universally. I would like to have means to deal with this problem by means of ad-hoc supertypes, but that will never happen due to lack of interest in reworking the language type system and because in "Dark Ages" there is virtually no research on fundamental language construction topics. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
lørdag 9. september 2023 kl. 19:56:00 UTC+2 skrev Stéphane Rivière: > Gnoga not dead, but being maintained by Pascal, Gautier and other > individuals and companies. > > Expect a pleasant surprise (imho) before the end of the year (with full > web demos). v22 manual abstract : > > > 1 About v22 framework > 1.1 Ready to use in production > > v22 is a general purpose, KISS oriented, modular Ada framework for > GNU/Linux Debian/Ubuntu service, console and web programs. > > v22 is composed of many packages in charge of UTF-8 strings, program and > OS functions, HTTP(s)/WS(s) web framework, integrated cURL, console > handling and text files, advanced network, MySQL and SQLite high level > binding, logging and configuration files handling. > > Although based on the v20 library, the v22 framework represents a major > step forward in the following areas: > - UTF-8 compatibility; > - Simplified string processing (only one UTF-8 String type is used); > - Internationalization; > - New and extended database API; > - Extended database access to MySQL, in addition to SQLite, with schema > on-the-fly update at table, index, and colums level; > - Improved concurrent access and performance for SQLite; > - New LGPLv3 licensing instead of GPLv3; > - New FSF GNAT GCC Linux ready-to-use development environment for v22 > (not tied anymore to GPLv2 licence); > - And much more. > > 1.2 Cooperative and open > > v22's native dependencies are Gnoga, Simple_Components, UXStrings and > Zanyblue. > > v22 is both a high-level framework and an extension to the lower level > components cited above. v22 has been designed to: > - Use unmodified components; > - Not "reinvent the wheel". Component functions are to be used first; > - Offer higher-level functions or functions that do not exist in the > components. > > .../... > > In short: > - UXStrings is used throughout v22. The v22.Uxs package extends > UXStrings functionality. The v22.Sql package extends the functionality > of Gnoga.Server.Database. The v22.Gui graphics framework is based on > Gnoga.Gui; > - v22's architecture allows it to be open to additional packages, > depending on the software development required. > > > -- > Stéphane Rivière > Ile d'Oléron - France Sounds like I can somehow trust that gnoga will be around many years to come. So my special issue: I work on making my (cancer) cellular behavior analysis program (https://korsnesbiocomputing.no/) as a "cloud service". Its all programmed in Ada using GLOBE_3D. I consider using guacamole apache. Its intensive about handling images. So what are the arguments for and against using gnoga (as compared to for example guacamole apache) ? reinert
lørdag 9. september 2023 kl. 19:56:00 UTC+2 skrev Stéphane Rivière: > Gnoga not dead, but being maintained by Pascal, Gautier and other > individuals and companies. > > Expect a pleasant surprise (imho) before the end of the year (with full > web demos). v22 manual abstract : > > > 1 About v22 framework > 1.1 Ready to use in production > > v22 is a general purpose, KISS oriented, modular Ada framework for > GNU/Linux Debian/Ubuntu service, console and web programs. > > v22 is composed of many packages in charge of UTF-8 strings, program and > OS functions, HTTP(s)/WS(s) web framework, integrated cURL, console > handling and text files, advanced network, MySQL and SQLite high level > binding, logging and configuration files handling. > > Although based on the v20 library, the v22 framework represents a major > step forward in the following areas: > - UTF-8 compatibility; > - Simplified string processing (only one UTF-8 String type is used); > - Internationalization; > - New and extended database API; > - Extended database access to MySQL, in addition to SQLite, with schema > on-the-fly update at table, index, and colums level; > - Improved concurrent access and performance for SQLite; > - New LGPLv3 licensing instead of GPLv3; > - New FSF GNAT GCC Linux ready-to-use development environment for v22 > (not tied anymore to GPLv2 licence); > - And much more. > > 1.2 Cooperative and open > > v22's native dependencies are Gnoga, Simple_Components, UXStrings and > Zanyblue. > > v22 is both a high-level framework and an extension to the lower level > components cited above. v22 has been designed to: > - Use unmodified components; > - Not "reinvent the wheel". Component functions are to be used first; > - Offer higher-level functions or functions that do not exist in the > components. > > .../... > > In short: > - UXStrings is used throughout v22. The v22.Uxs package extends > UXStrings functionality. The v22.Sql package extends the functionality > of Gnoga.Server.Database. The v22.Gui graphics framework is based on > Gnoga.Gui; > - v22's architecture allows it to be open to additional packages, > depending on the software development required. > > > -- > Stéphane Rivière > Ile d'Oléron - France Sounds like I can somehow trust that gnoga will be around many years to come. So my special issue: I work on making my (cancer) cellular behavior analysis program (https://korsnesbiocomputing.no/) as a "cloud service". Its all programmed in Ada using GLOBE_3D. I consider using guacamole apache. Its intensive about handling images. So what are the aguments for and against using guaceamole (as compared to for example guacamole apache) ? reinert
"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes: > On 2023-09-09 02:25, Ben Bacarisse wrote: >> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes: >>> [rant on] >>> An Ada programmer would just write a loop. >> Yes, that's fine. Different languages have different objectives. Just >> write the empty range test and the loop you need for each kind of >> collection. > > You can loop in Ada over empty ranges, no problem. Yes, but the problem in hand (maximum of F over X) should raise an error on an empty X. I know there are other options, but you chose to raise an error so that's the design I was talking about. >> That was definitely the way things were done in the 80s. > > Yes, before the Dark Ages of Computing... Eh? There have been repeated updates to the Ada language. Are they taking Ada into the dark ages? If so, what was the golden age of Ada when its design was perfect for numerical algorithms? >>> As I said you think in a wrong direction of abstracting the language >>> "finding maximum" rather than the problem space, e.g. generalization to >>> other bases, other mathematical structures etc. >> Generalising to an arbitrary base is local to the function that finds >> the answer for one element. It's an entirely separate axis of >> generalisation to that of where the elements come from. >> It's interesting to me that you consider one simply wrong and the other >> natural. > > Because one is a software design artifact and another is the result of > problem space analysis. Which one the wrong one? >> In some languages the "wrong" one does not even merit >> consideration as it's just there for free. > > Being a part of design it has all possible merits to consider and then > reject it. That is in the position of a puzzle solver. Now in the position > of a library designer, the Ada standard library has an [informal] interface > that supports what you wanted: Well, there has been some confusion over that, but from what I understand of the code below, adding in a function to maximise would be simple. > 1. Cursor > 2. Key at the cursor > 3. Element at the cursor > 4. Iterate procedure > > So, for the Ada standard library it might look like this: > > generic > type Container_Type (<>) is limited private; > type Element_Type is private; > type Key_Type is private; > type Cursor_Type is private; > with function "<" (Left, Right : Element_Type) return Boolean is <>; > with function Key (Position : Cursor_Type) return Key_Type is <>; > with function Element > ( Position : Cursor_Type > ) return Element_Type is <>; > with procedure Iterate > ( Container : Container_Type; > Process : not null access procedure > (Position : Cursor_Type) > ) is <>; > function Generic_Container_Maximum_At (Container : Container_Type) > return Key_Type; > > function Generic_Container_Maximum_At (Container : Container_Type) > return Key_Type is > Found : Boolean := False; > Max : Element_Type; > Result : Key_Type; > procedure Walker (Position : Cursor_Type) is > begin > if Found then > if Max < Element (Position) then > Result := Key (Position); > Max := Element (Position); > end if; > else > Result := Key (Position); > Max := Element (Position); > Found := True; > end if; > end Walker; > begin > Iterate (Container, Walker'Access); > if Found then > return Result; > else > raise Constraint_Error with "Empty container"; > end if; > end Generic_Container_Maximum_At; > > Instantiation: > > package Integer_Maps is > new Ada.Containers.Ordered_Maps (Integer, Integer); > use Integer_Maps; > function Integer_Map_Max is > new Generic_Container_Maximum_At (Map, Integer, Integer, Cursor); This is probably the closest we can get to a universal solution. Vectors don't have a Key function but I am sure I could find out what should be provided there. Thanks. I agree that is does not feel worth it. Just write the loop our each time. -- Ben.
"G.B." <bauhaus@notmyhomepage.invalid> writes: > On 08.09.23 23:02, Ben Bacarisse wrote: >> "G.B." <bauhaus@notmyhomepage.invalid> writes: >> >>> On 07.09.23 01:32, Ben Bacarisse wrote: >>> >>> >>>> A fix (though it's not really ideal) would be to use function >>>> composition here (inventing . as the composition operator): >>> >>> Hm. A stateful, composed function that needs to be applied >>> in a certain way. Is that so different from calling interface >>> subprograms of a certain type? >> There was nothing stateful (as I understand the term) in either function >> being composed. > > The "apparatus" that the computation needs in order to remember > "max so far" looks like part of its state to me. The "max so far" function is not being composed. > Somehow > "the function" needs to operate this state and evaluate it. > Extend this to: > - find the maximum of [the maxima of] these n collections > - find the maximum in this stream at 10 seconds from now. > > Is it possible, or practical, to define a pure function so that > calling it will remember the needed information, n >= 0 > being arbitrary? I am not sure how the discussion got here. Ada is an imperative language so of course one would use "running" state to calculate a maximum. The max_of_F_over_X function just loops like any other loop from First_Of(X) to Last_Of(X) calculating F(This(X)), comparing that with Max_So_Far. These are invented names, of course, because I don't know how it should be done, but the idea is plain imperative code. In fact, it's possible that Ada has some entirely different syntax for this kind of imperative loop. The "fix" to use a composed function was because one proposed solution found the maximum of Element(C) (where C was a cursor) because Element was passed as F, but that of course is not what was wanted. To find the maximum of F I speculated that one could pass F.Element. >>> So, does type composition help? >> My turn to guess now: you are not being serious? I see no connection to >> monads or type composition. > > In the following sense: > There is an object of type So_Far that can remember > objects of any type T, them coming from collections > of type C-of-T. Given the above confusion about what is being composed, I can see the connection with monads. But there is no reason to use the concept of a monad in a language with modifiable state. The maximum should be found as in the posted code with a simple loop. > I'm not sure if the new Ada.Iterator_Interfaces (LRM 5.5.1) > could solve this, also because I really don't know that yet. > But it looks like I'd need instances of specific containers > for instantiation. (That being consistent with Ada's approach > to the STL, I think.) Thanks for the pointer. I am not sure I have time to look in detail, but it looks interesting. -- Ben.
Gnoga not dead, but being maintained by Pascal, Gautier and other individuals and companies. Expect a pleasant surprise (imho) before the end of the year (with full web demos). v22 manual abstract : 1 About v22 framework 1.1 Ready to use in production v22 is a general purpose, KISS oriented, modular Ada framework for GNU/Linux Debian/Ubuntu service, console and web programs. v22 is composed of many packages in charge of UTF-8 strings, program and OS functions, HTTP(s)/WS(s) web framework, integrated cURL, console handling and text files, advanced network, MySQL and SQLite high level binding, logging and configuration files handling. Although based on the v20 library, the v22 framework represents a major step forward in the following areas: - UTF-8 compatibility; - Simplified string processing (only one UTF-8 String type is used); - Internationalization; - New and extended database API; - Extended database access to MySQL, in addition to SQLite, with schema on-the-fly update at table, index, and colums level; - Improved concurrent access and performance for SQLite; - New LGPLv3 licensing instead of GPLv3; - New FSF GNAT GCC Linux ready-to-use development environment for v22 (not tied anymore to GPLv2 licence); - And much more. 1.2 Cooperative and open v22's native dependencies are Gnoga, Simple_Components, UXStrings and Zanyblue. v22 is both a high-level framework and an extension to the lower level components cited above. v22 has been designed to: - Use unmodified components; - Not "reinvent the wheel". Component functions are to be used first; - Offer higher-level functions or functions that do not exist in the components. .../... In short: - UXStrings is used throughout v22. The v22.Uxs package extends UXStrings functionality. The v22.Sql package extends the functionality of Gnoga.Server.Database. The v22.Gui graphics framework is based on Gnoga.Gui; - v22's architecture allows it to be open to additional packages, depending on the software development required. -- Stéphane Rivière Ile d'Oléron - France
lørdag 9. september 2023 kl. 13:59:04 UTC+2 skrev Jeffrey R.Carter:
> On 2023-09-09 11:02, reinert wrote:
> > I asked google bard:
> >
> > "Is gnoga currently maintained?"
> >
> > And it answered:
> >
> > "No, Gnoga (Ada) is also no longer maintained. It was a fork of the original
> Gnoga project that was created in 2012. The last commit to the GitHub repository
> was in 2016.
> >
> > Gnoga (Ada) was an attempt to improve the performance and scalability of
> Gnoga. It used a different statistical approach to NLG and was implemented in Ada.
> >
> > There are a number of other NLG engines available, such as GPT-3 and LaMDA,
> which are more powerful and up-to-date than Gnoga (Ada)."
> >
> > Is this correct?
> The presence of the word "also" in the first sentence should be enough to tell
> you that this is nonsense.
>
> If you are asking about an "NLG engine" named gnoga, then maybe this is correct.
> If you are asking about the Ada web-application framework Gnoga that Blady
> maintains, then it's not correct.
>
> --
> Jeff Carter
> “Anyone who cannot cope with mathematics
> is not fully human.”
> The Notebooks of Lazarus Long
> 214
Good to hear.
Yes, did mean the Ada web-application framework.
reinert
On 2023-09-09 11:02, reinert wrote: > I asked google bard: > > "Is gnoga currently maintained?" > > And it answered: > > "No, Gnoga (Ada) is also no longer maintained. It was a fork of the original Gnoga project that was created in 2012. The last commit to the GitHub repository was in 2016. > > Gnoga (Ada) was an attempt to improve the performance and scalability of Gnoga. It used a different statistical approach to NLG and was implemented in Ada. > > There are a number of other NLG engines available, such as GPT-3 and LaMDA, which are more powerful and up-to-date than Gnoga (Ada)." > > Is this correct? The presence of the word "also" in the first sentence should be enough to tell you that this is nonsense. If you are asking about an "NLG engine" named gnoga, then maybe this is correct. If you are asking about the Ada web-application framework Gnoga that Blady maintains, then it's not correct. -- Jeff Carter “Anyone who cannot cope with mathematics is not fully human.” The Notebooks of Lazarus Long 214
lørdag 9. september 2023 kl. 11:53:40 UTC+2 skrev Blady: > Le 09/09/2023 à 11:02, reinert a écrit : > > I asked google bard: > > > > "Is gnoga currently maintained?" > > > > And it answered: > > > > "No, Gnoga (Ada) is also no longer maintained. It was a fork of the original Gnoga project that was created in 2012. The last commit to the GitHub repository was in 2016. > > > > Gnoga (Ada) was an attempt to improve the performance and scalability of Gnoga. It used a different statistical approach to NLG and was implemented in Ada. > > > > There are a number of other NLG engines available, such as GPT-3 and LaMDA, which are more powerful and up-to-date than Gnoga (Ada)." > > > > Is this correct? > Hello Reinert, > > Do you mean this one: https://sourceforge.net/projects/gnoga? > > If so, the answer is yes. > > Could you please provide the link where you found the above quoted text? > > Pascal. I just logged into my google account and asked "bard" (https://bard.google.com/?hl=en). reinert
Le 09/09/2023 à 11:02, reinert a écrit : > I asked google bard: > > "Is gnoga currently maintained?" > > And it answered: > > "No, Gnoga (Ada) is also no longer maintained. It was a fork of the original Gnoga project that was created in 2012. The last commit to the GitHub repository was in 2016. > > Gnoga (Ada) was an attempt to improve the performance and scalability of Gnoga. It used a different statistical approach to NLG and was implemented in Ada. > > There are a number of other NLG engines available, such as GPT-3 and LaMDA, which are more powerful and up-to-date than Gnoga (Ada)." > > Is this correct? Hello Reinert, Do you mean this one: https://sourceforge.net/projects/gnoga? If so, the answer is yes. Could you please provide the link where you found the above quoted text? Pascal.
On 2023-09-09 02:25, Ben Bacarisse wrote: > "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes: > >> On 2023-09-08 03:32, Ben Bacarisse wrote: >>> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes: >>> >>>> On 2023-09-07 01:32, Ben Bacarisse wrote: >>>>> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes: >>>>> > I wanted the maximum of a function over a collection (range, array, map, > etc). In some languages, collections can be scanned so you don't need > to know where the data come from. Hmm, the thing we discussed was a maximum element in array or map rather than a maximum of a function over the *domain* set of array or map. In a typed language array /= domain of array. >>>> Then you would pass Has_Element for it. For integers you would use wrapped >>>> X'Valid (there is no Integer'Valid, unfortunately. Only X'Valid where X is >>>> an object). >>> It's definitely getting what I call cumbersome. >> >> Yes, because you try too hard to make it work where it probably should >> not. > > If you think a resuable Ada function that can find the maximum of some F > over some 'collection' X is possible, I'd like to see how it's done. To start with, no such function exists. Not in a typed language. Note that a generic function is not a function. So instead we must consider language constructs for the purpose. Generic instantiation is one of them, some class might be another, but in Ada we just use loops. (And yes, people liking writing programs while standing on their heads, may use recursion... (:-)) > I > can do it for some kinds of X but I have no idea how general it can be > made in Ada. I think the answer is either that it can't be very > general, or to make it very general is too much work, or that one should > not be trying in the first place. The limits of generality are defined by the interfaces. In Ada types are designed to implement needed interfaces upfront. If you want to do that after the fact, you need some other adapter types to shove an existing type into something it was not designed for. >>> I don't think this is incoherent. The Haskell libraries ensure that any >>> collection that is logically foldable is indeed foldable. >> >> Ada arrays and library containers do not share interfaces. > > I was pretty sure that was the case. Thanks for confirming. I think > that means there can be no truly generic solution. But maybe it's > possible at least for all container types in the library? If a library is designed with this purpose in mind, that is trivial as you just pointed out. All collection types in the library would implement the required interface. End of story. > (But I note > that if you think it /shouldn't/ be done, I won't expect you to show me > how.) That is not a language question. It is a question of the library design. What if the library did not follow the desired design? That would be a language question and Ada offers some means, but not enough from my point of view due to the limitation of its type system. >> Should the language allow adding >> ad-hoc interfaces to existing types. Yes, and this is possible in Ada in >> some very uncomfortable AKA cumbersome way, which is why "finding maximum" >> is not a worthy abstraction in Ada. > > I suspected one might have to extend the interfaces. You cannot in a strongly typed language without breaking too much things. You must create another type related to the old one and implementing the new interface (superclass). That would do the trick. Ada cannot this, so you go for the poor man's substitute: a mix-in. I.e. you create a new type that references an object of the old type. E.g. see array cursors example in my earlier post. >>> What closure is required for a function composition? There is no >>> environment to "close over". >> >> In Ada a function can use anything visible at its declaration point and at >> the location of its body. You can even declare a function inside a >> recursively called function and let it see local variables of each >> recursive call, in effect having an infinite set of functions. > > At the point where I want Period.Element I can write the (almost) > one-line function that takes a Cursor and returns Period(Element(C)) > entirely mechanically. Can't the compiler do that? No. (Ada indeed composes functions in some limited number of cases, e.g. an explicit type conversion of [in] out arguments. But these are predefined.) > Note I'm not asking if it /should/ (it may not be "Ada-like" to do > that). I'm just curious if there really is a technical reason it can't > be done. Actually compositions might be useful in many cases and adapting interfaces is one of them. >>> That's a lot just to use something that is supposed to be reusable. >> >> [rant on] >> An Ada programmer would just write a loop. > > Yes, that's fine. Different languages have different objectives. Just > write the empty range test and the loop you need for each kind of > collection. You can loop in Ada over empty ranges, no problem. > That was definitely the way things were done in the 80s. Yes, before the Dark Ages of Computing... >>> It only occurred to me after writing the non-generic solution. I >>> remember Ada as being something of a pioneer in it's attempt to provide >>> generic solutions, so I wondered how far things had come. I don't think >>> something really widely reusable is possible in this case. >> >> As I said you think in a wrong direction of abstracting the language >> "finding maximum" rather than the problem space, e.g. generalization to >> other bases, other mathematical structures etc. > > Generalising to an arbitrary base is local to the function that finds > the answer for one element. It's an entirely separate axis of > generalisation to that of where the elements come from. > > It's interesting to me that you consider one simply wrong and the other > natural. Because one is a software design artifact and another is the result of problem space analysis. > In some languages the "wrong" one does not even merit > consideration as it's just there for free. Being a part of design it has all possible merits to consider and then reject it. That is in the position of a puzzle solver. Now in the position of a library designer, the Ada standard library has an [informal] interface that supports what you wanted: 1. Cursor 2. Key at the cursor 3. Element at the cursor 4. Iterate procedure So, for the Ada standard library it might look like this: generic type Container_Type (<>) is limited private; type Element_Type is private; type Key_Type is private; type Cursor_Type is private; with function "<" (Left, Right : Element_Type) return Boolean is <>; with function Key (Position : Cursor_Type) return Key_Type is <>; with function Element ( Position : Cursor_Type ) return Element_Type is <>; with procedure Iterate ( Container : Container_Type; Process : not null access procedure (Position : Cursor_Type) ) is <>; function Generic_Container_Maximum_At (Container : Container_Type) return Key_Type; function Generic_Container_Maximum_At (Container : Container_Type) return Key_Type is Found : Boolean := False; Max : Element_Type; Result : Key_Type; procedure Walker (Position : Cursor_Type) is begin if Found then if Max < Element (Position) then Result := Key (Position); Max := Element (Position); end if; else Result := Key (Position); Max := Element (Position); Found := True; end if; end Walker; begin Iterate (Container, Walker'Access); if Found then return Result; else raise Constraint_Error with "Empty container"; end if; end Generic_Container_Maximum_At; Instantiation: package Integer_Maps is new Ada.Containers.Ordered_Maps (Integer, Integer); use Integer_Maps; function Integer_Map_Max is new Generic_Container_Maximum_At (Map, Integer, Integer, Cursor); -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
I asked google bard: "Is gnoga currently maintained?" And it answered: "No, Gnoga (Ada) is also no longer maintained. It was a fork of the original Gnoga project that was created in 2012. The last commit to the GitHub repository was in 2016. Gnoga (Ada) was an attempt to improve the performance and scalability of Gnoga. It used a different statistical approach to NLG and was implemented in Ada. There are a number of other NLG engines available, such as GPT-3 and LaMDA, which are more powerful and up-to-date than Gnoga (Ada)." Is this correct? reinert
On 08.09.23 23:02, Ben Bacarisse wrote: > "G.B." <bauhaus@notmyhomepage.invalid> writes: > >> On 07.09.23 01:32, Ben Bacarisse wrote: >> >> >>> A fix (though it's not really ideal) would be to use function >>> composition here (inventing . as the composition operator): >> >> Hm. A stateful, composed function that needs to be applied >> in a certain way. Is that so different from calling interface >> subprograms of a certain type? > > There was nothing stateful (as I understand the term) in either function > being composed. The "apparatus" that the computation needs in order to remember "max so far" looks like part of its state to me. Somehow "the function" needs to operate this state and evaluate it. Extend this to: - find the maximum of [the maxima of] these n collections - find the maximum in this stream at 10 seconds from now. Is it possible, or practical, to define a pure function so that calling it will remember the needed information, n >= 0 being arbitrary? >> So, does type composition help? > > My turn to guess now: you are not being serious? I see no connection to > monads or type composition. In the following sense: There is an object of type So_Far that can remember objects of any type T, them coming from collections of type C-of-T. > And why bring C++ into it? It's already there, you mentioned the pair of iterators, and there is std::max_element() which finds the greatest element in any range based solely on these, and optionally using a generic comparison. There are similar things in Dmitry's packages. A key difference seems to be that Ada's Cursors are tied to a specific collection. I don't know of any convenient way around this, maybe because type Cursor is just private in every Ada.Containers.Xyz and there is no common type name for them, or for what some algorithm might need them to have in common. I'm not sure if the new Ada.Iterator_Interfaces (LRM 5.5.1) could solve this, also because I really don't know that yet. But it looks like I'd need instances of specific containers for instantiation. (That being consistent with Ada's approach to the STL, I think.)
"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes: > On 2023-09-08 03:32, Ben Bacarisse wrote: >> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes: >> >>> On 2023-09-07 01:32, Ben Bacarisse wrote: >>>> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes: >>>> >>>>> On 2023-09-06 17:16, Ben Bacarisse wrote: >>>>> >>>> Second, if I try to use a Vector rather than an Ordered_Map, I am told >>>> that: >>>> test2.adb:97:05: error: instantiation error at line 12 >>>> test2.adb:97:05: error: no visible subprogram matches the specification for "<" >>>> It would seem that vector cursors can't be compared using < (at least by >>>> default). Maybe the installation needs more arguments. >>> >>> Vector has a proper index type. All you have to do is. Given >>> >>> package Integer_Vectors is >>> new Ada.Containers.Vectors (Integer, Integer); >>> >>> Wrap Element into a function: >>> >>> V : Integer_Vectors.Vector; >>> function Element (Index : Integer) return Integer is >>> begin >>> return V.Element (Index); >>> end Element; >>> ... >>> >>> and use the wrapper. >> Sure, but the hope was to write something that does not need new >> code for new situations. That's what makes it reusable. > > Why should it be? You wanted to find maximum of a function. Vector is > not a function. I wanted the maximum of a function over a collection (range, array, map, etc). In some languages, collections can be scanned so you don't need to know where the data come from. >>> Then you would pass Has_Element for it. For integers you would use wrapped >>> X'Valid (there is no Integer'Valid, unfortunately. Only X'Valid where X is >>> an object). >> It's definitely getting what I call cumbersome. > > Yes, because you try too hard to make it work where it probably should > not. If you think a resuable Ada function that can find the maximum of some F over some 'collection' X is possible, I'd like to see how it's done. I can do it for some kinds of X but I have no idea how general it can be made in Ada. I think the answer is either that it can't be very general, or to make it very general is too much work, or that one should not be trying in the first place. (I put 'collection' in quotes because I know that's an Ada term but I don't necessarily want to restrict the solution to how Ada uses the term. For example, I don't think native arrays are collections in the formal Ada library sense.) >> I don't think this is incoherent. The Haskell libraries ensure that any >> collection that is logically foldable is indeed foldable. > > Ada arrays and library containers do not share interfaces. I was pretty sure that was the case. Thanks for confirming. I think that means there can be no truly generic solution. But maybe it's possible at least for all container types in the library? (But I note that if you think it /shouldn't/ be done, I won't expect you to show me how.) > Should the language allow adding > ad-hoc interfaces to existing types. Yes, and this is possible in Ada in > some very uncomfortable AKA cumbersome way, which is why "finding maximum" > is not a worthy abstraction in Ada. I suspected one might have to extend the interfaces. If a simple abstraction (maximise F over X) does not have a simple representation, it's not going to be worth it. Just write a slightly different empty test and loop each time you need to do it. >>>> A fix (though it's not really ideal) would be to use function >>>> composition here (inventing . as the composition operator): >>>> Map_Functions.Maximum_At (X.First, X.Last, Period'Access >>>> . Element'Access) >>>> but I don't think Ada has a function composition operator, does it? >>> >>> No as it would require closures. >> What closure is required for a function composition? There is no >> environment to "close over". > > In Ada a function can use anything visible at its declaration point and at > the location of its body. You can even declare a function inside a > recursively called function and let it see local variables of each > recursive call, in effect having an infinite set of functions. At the point where I want Period.Element I can write the (almost) one-line function that takes a Cursor and returns Period(Element(C)) entirely mechanically. Can't the compiler do that? Note I'm not asking if it /should/ (it may not be "Ada-like" to do that). I'm just curious if there really is a technical reason it can't be done. >> That's a lot just to use something that is supposed to be reusable. > > [rant on] > An Ada programmer would just write a loop. Yes, that's fine. Different languages have different objectives. Just write the empty range test and the loop you need for each kind of collection. That was definitely the way things were done in the 80s. >> It only occurred to me after writing the non-generic solution. I >> remember Ada as being something of a pioneer in it's attempt to provide >> generic solutions, so I wondered how far things had come. I don't think >> something really widely reusable is possible in this case. > > As I said you think in a wrong direction of abstracting the language > "finding maximum" rather than the problem space, e.g. generalization to > other bases, other mathematical structures etc. Generalising to an arbitrary base is local to the function that finds the answer for one element. It's an entirely separate axis of generalisation to that of where the elements come from. It's interesting to me that you consider one simply wrong and the other natural. In some languages the "wrong" one does not even merit consideration as it's just there for free. You can concentrate on the other bases and other structures without worrying if the program will be able to maximise over the collection in which they are stored. (For example, for polynomial residues, they can't come from a range like 2..999.) I really do appreciate your help. I would not have got off the ground with generics without your examples. Also, one thing I like about Usenet is coming across people with very different ideas about programming. In this case, it seems to be about what is worth generalising and what isn't. -- Ben.
"G.B." <bauhaus@notmyhomepage.invalid> writes: > On 07.09.23 01:32, Ben Bacarisse wrote: > > >> A fix (though it's not really ideal) would be to use function >> composition here (inventing . as the composition operator): > > Hm. A stateful, composed function that needs to be applied > in a certain way. Is that so different from calling interface > subprograms of a certain type? There was nothing stateful (as I understand the term) in either function being composed. As to your question, not being an Ada expert I can't answer. I could not see any fix other than passing a composed function which would, it seems, have to be written afresh. Is that what your question refers to? If so, then yes there is a small difference: writing a function (albeit just a few lines) vs. applying an operator to two already written functions. > A wild guess: only "monads" would add substantial toppings > to the commonalities. Considering the computational powers of > C++'s "hair-raising template metaprogramming" [14.4], the idea > of "Ada generics" = "functional style" is probably limited > in scope. > > So, does type composition help? My turn to guess now: you are not being serious? I see no connection to monads or type composition. And why bring C++ into it? Having found the maximum of the function 'Period' over a range 2..999, you might find yourself a week later wanting the maximum absolute value of the numbers in an Ordered_Map. And then later the maximum of sine squared over the elements of 2D array. You might want to have a resuable "maximum of F over X" function, so I was curious about how close one could get to this in Ada (or, more accurately, what the restrictions on X and F might have to be). -- Ben.
On 2023-09-08 03:32, Ben Bacarisse wrote: > "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes: > >> On 2023-09-07 01:32, Ben Bacarisse wrote: >>> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes: >>> >>>> On 2023-09-06 17:16, Ben Bacarisse wrote: >>>> >>> Second, if I try to use a Vector rather than an Ordered_Map, I am told >>> that: >>> test2.adb:97:05: error: instantiation error at line 12 >>> test2.adb:97:05: error: no visible subprogram matches the specification for "<" >>> It would seem that vector cursors can't be compared using < (at least by >>> default). Maybe the installation needs more arguments. >> >> Vector has a proper index type. All you have to do is. Given >> >> package Integer_Vectors is >> new Ada.Containers.Vectors (Integer, Integer); >> >> Wrap Element into a function: >> >> V : Integer_Vectors.Vector; >> function Element (Index : Integer) return Integer is >> begin >> return V.Element (Index); >> end Element; >> ... >> >> and use the wrapper. > > Sure, but the hope was to write something that does not need new > code for new situations. That's what makes it reusable. Why should it be? You wanted to find maximum of a function. Vector is not a function. It is in mathematical terms, but not in the language terms. The abstraction for finding maximum in a container is just a different abstraction. >> Then you would pass Has_Element for it. For integers you would use wrapped >> X'Valid (there is no Integer'Valid, unfortunately. Only X'Valid where X is >> an object). > > It's definitely getting what I call cumbersome. Yes, because you try too hard to make it work where it probably should not. > I don't think this is incoherent. The Haskell libraries ensure that any > collection that is logically foldable is indeed foldable. Ada arrays and library containers do not share interfaces. [It is a long discussion how they could be]. But similarly, there is no shared interface between digits of a number in octal base and a container and a string in UTF-16 encoding. Should there be? No. Should the language allow adding ad-hoc interfaces to existing types. Yes, and this is possible in Ada in some very uncomfortable AKA cumbersome way, which is why "finding maximum" is not a worthy abstraction in Ada. >>> The bottom line is the last argument should be something very general >>> like the Period function. >>> A fix (though it's not really ideal) would be to use function >>> composition here (inventing . as the composition operator): >>> Map_Functions.Maximum_At (X.First, X.Last, Period'Access >>> . Element'Access) >>> but I don't think Ada has a function composition operator, does it? >> >> No as it would require closures. > > What closure is required for a function composition? There is no > environment to "close over". In Ada a function can use anything visible at its declaration point and at the location of its body. You can even declare a function inside a recursively called function and let it see local variables of each recursive call, in effect having an infinite set of functions. > That's a lot just to use something that is supposed to be reusable. [rant on] An Ada programmer would just write a loop. Abstractions are meant to abstract the problem domain. If you starting abstract elementary programming activities, then there might be something wrong with the language or with you. Then there is a point about readability. When I see a loop I say, aha this is what the guy is going to do. When I see a pile of calls of a dozen generic instances with arbitrary names, I begin to worry. In my view it is a road to nowhere, for an imperative language at least. The end of this road can be seen in modern C++. 20 years ago C++ was severely crippled broken but sometimes enjoyable language. You could *read* a C++ program. In these days with all libraries it became Forth on steroids. There is no such thing as a C++ program anymore, just calls upon calls. [rant off] > It only occurred to me after writing the non-generic solution. I > remember Ada as being something of a pioneer in it's attempt to provide > generic solutions, so I wondered how far things had come. I don't think > something really widely reusable is possible in this case. As I said you think in a wrong direction of abstracting the language "finding maximum" rather than the problem space, e.g. generalization to other bases, other mathematical structures etc. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
On 07.09.23 01:32, Ben Bacarisse wrote:
> A fix (though it's not really ideal) would be to use function
> composition here (inventing . as the composition operator):
Hm. A stateful, composed function that needs to be applied
in a certain way. Is that so different from calling interface
subprograms of a certain type?
A wild guess: only "monads" would add substantial toppings
to the commonalities. Considering the computational powers of
C++'s "hair-raising template metaprogramming" [14.4], the idea
of "Ada generics" = "functional style" is probably limited
in scope.
So, does type composition help?
[14.4]: A Tour of C++, 3rd ed.
"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes: > On 2023-09-07 01:32, Ben Bacarisse wrote: >> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes: >> >>> On 2023-09-06 17:16, Ben Bacarisse wrote: >>> >>>> I am curious to know how reusable this is. Can the packages be >>>> instantiated in such a way that the argument ranges over the elements >>>> of, say, and Ordered_Map? >>> >>> Sure: >>> >>> with Ada.Containers.Ordered_Maps; >>> >>> package Integer_Maps is >>> new Ada.Containers.Ordered_Maps (Integer, Integer); >>> use Integer_Maps; >>> package Cursor_Arguments is new Generic_Arguments (Cursor); >> Ah! So the arguments correspond to the "with" functions in the order >> listed, and, since Cursor already has Next, there no need to specify >> anything. > > Yes, because the formal argument is > > with function Next (Value : Argument_Type) > return Argument_Type is <>; > > If it were > > with function Next (Value : Argument_Type) > return Argument_Type; > > You would have to specify the actual. The part "is <>" tells to match a > visible function Next. Thanks. I remember that now. Given Ada's preference for words, it's a mysterious choice. >> There are a couple of details that prevent your Maximum_At function from >> working properly in this case though. First, we can't have an empty >> map, because X.Last can't be compared with X.First when either is >> No_Element, so the test for Right < Left fails before the desired error >> can be raised. > > Yes, cursors is bad idea, in the end they all are pointers. No_Element is > an equivalent of null which shows. > > However Maximum_At will propagate Constraint_Error if either of the bounds > is No_Element. So the implementation would work. Sure, but ideally we want the error we decided on for this situation. Since the intent is to be generic, it's a shame to get one error with some instantiations and a different one with others. >> Second, if I try to use a Vector rather than an Ordered_Map, I am told >> that: >> test2.adb:97:05: error: instantiation error at line 12 >> test2.adb:97:05: error: no visible subprogram matches the specification for "<" >> It would seem that vector cursors can't be compared using < (at least by >> default). Maybe the installation needs more arguments. > > Vector has a proper index type. All you have to do is. Given > > package Integer_Vectors is > new Ada.Containers.Vectors (Integer, Integer); > > Wrap Element into a function: > > V : Integer_Vectors.Vector; > function Element (Index : Integer) return Integer is > begin > return V.Element (Index); > end Element; > ... > > and use the wrapper. Sure, but the hope was to write something that does not need new code for new situations. That's what makes it reusable. >> Anyway, I am still not sure how to write a generic test for an empty >> range. > > The problem is that the implementation of Cursor that breaks > abstraction. The abstraction of an argument does not permit ideal > non-values. Cursors and pointers have non-values. So if you want to test > for non-values ahead, instead of surprising the function, you need to add a > test for value validity to the abstraction: > > generic > -- Ordered argument > type Argument_Type is private; > with function Valid (Value : Argument_Type) return Boolean is <>; > ... > package Generic_Arguments is > > Then you would pass Has_Element for it. For integers you would use wrapped > X'Valid (there is no Integer'Valid, unfortunately. Only X'Valid where X is > an object). It's definitely getting what I call cumbersome. >> It's possible I was not clear about what I was aiming for. I was hoping >> to be able to find the maximum of some arbitrary function, taking the >> function's arguments from any sequential collection. > > That is a different abstraction. You need a generic collection instead of > generic ordered values. E.g. > > generic > with package Arguments is new Ada.Containers.Ordered_Sets (<>); > with package Values is new Generic_Values (<>); > package Generic_Comparable_Valued is > use Arguments, Values; > function Maximum_At > ( Domain : Set; > Func : access function (Argument : Element_Type) > return Value_Type > ) return Value_Type; > -- Other useless functions > end Generic_Comparable_Valued; > > package body Generic_Comparable_Valued is > function Maximum_At > ( Domain : Set; > Func : access function (Argument : Element_Type) > return Value_Type > ) return Value_Type is > Max : Value_Type; > Value : Value_Type; > Position : Cursor; > begin > if Domain.Is_Empty then > raise Constraint_Error with "Empty set"; > end if; > Position := Domain.First; > Max := Func (Element (Position)); > while Position /= Domain.Last loop > Position := Next (Position); > Value := Func (Element (Position)); > if Max < Value then > Max := Value; > end if; > end loop; > return Max; > end Maximum_At; > end Generic_Comparable_Valued; > >> Either a simple >> range of values, an array or vector of values, a list of values or even >> an ordered map of values -- any ordered list of values. > > In practice such abstraction have too much physical and mental > overhead. E.g. large sets of values implemented differently from > Ada.Containers.Ordered_Sets depending on the operations required. For > example, let you need a set complement? Usually programmers simply stick > with software patterns instead. Too much reliance of libraries make > programs incoherent. The core of my Haskell solution is just a function decimalRepeatLength that returns the repeat length given a divisor. But once I'd got the answer (by applying it to 2 to 999 and getting the maximum) I wondered what would happen if the numbers were not in a simple range. Is it easy to write a `maximisedOver` function that finds the maximum of some function over any ordered collection (technically, a "foldable" type in Haskell). Well, yes, it is easy: function `maximisedOver` anything = maximum (fmap function anything) so the solution to the project Euler problem is just decimalRepeatLength `maximisedOver` [2..999] but I can also find the maximum of this (or any other suitable) function over an array, a hash map, a vector... whatever. No code changes anywhere. It even works with arrays of any number of dimensions regardless of the index bounds. maximisedOver is genuinely generic and reusable. I don't think this is incoherent. The Haskell libraries ensure that any collection that is logically foldable is indeed foldable. >> The bottom line is the last argument should be something very general >> like the Period function. >> A fix (though it's not really ideal) would be to use function >> composition here (inventing . as the composition operator): >> Map_Functions.Maximum_At (X.First, X.Last, Period'Access >> . Element'Access) >> but I don't think Ada has a function composition operator, does it? > > No as it would require closures. What closure is required for a function composition? There is no environment to "close over". > So you can have a generic composition > operator, no problem, but not a first-class one. However you can simply add > Maximum_At with four arguments to the package. This may be the closest we can get with Ada. >> Another solution would be to write Maximum_At so that it knows it has a >> cursor argument, but then I don't think it would work for native arrays, >> would it? And we'd loose plain ranges altogether. > > You can write a generic package creating array cursors: > > generic > type Index_Type is (<>); > type Element_Type is private; > type Array_Type is array (Index_Type range <>) of Element_Type; > package Array_Cursors is > type Cursor is private; > function First (Container : Array_Type) return Cursor; > function Element (Position : Cursor) return Element_Type; > function "<" (Left, Right : Cursor) return Boolean; > ... > private > package Dirty_Tricks is > new System.Address_To_Access_Conversions (Array_Type); > use Dirty_Tricks; > type Cursor is record > Domain : Object_Pointer; > Index : Index_Type; > end record; > end Array_Cursors; > > package body Array_Cursors is > function "<" (Left, Right : Cursor) return Boolean is > begin > if Left.Domain = null or else Left.Domain /= Right.Domain then > raise Constraint_Error with "Incomparable cursors"; > end if; > return Left.Index < Right.Index; > end "<"; > > function Element (Position : Cursor) return Element_Type is > begin > if Position.Domain = null or else > Position.Index not in Position.Domain'Range > then > raise Constraint_Error with "Invalid cursor"; > else > return Position.Domain (Position.Index); > end if; > end Element; > > function First (Container : Array_Type) return Cursor is > begin > if Container'Length = 0 then > raise Constraint_Error with "Empty array"; > else > return (To_Pointer (Container'Address), Container'First); > end if; > end First; > > end Array_Cursors; That's a lot just to use something that is supposed to be reusable. >> You seem to be on your own as far as helping out is concerned! > > Because it started as a numeric puzzle. You should have asked directly > about generics or tagged types instead. It only occurred to me after writing the non-generic solution. I remember Ada as being something of a pioneer in it's attempt to provide generic solutions, so I wondered how far things had come. I don't think something really widely reusable is possible in this case. -- Ben.
On 2023-09-07 18:06, Blady wrote: > Well, I was questioning myself about the choice between named access and > anonymous access in the old Ada port of Java library, for instance: > > type Typ; > type Ref is access all Typ'Class; > type Typ(LayoutManager2_I : Java.Awt.LayoutManager2.Ref; > Serializable_I : Java.Io.Serializable.Ref) > is new Java.Lang.Object.Typ > with null record; > ------------------------------ > -- Constructor Declarations -- > ------------------------------ > function New_BorderLayout (This : Ref := null) > return Ref; Contravariance is unsafe. I gather that Typ is tagged. If you ever derive from it, it will "inherit" the broken construction function, because the function is class-wide. The safe choice here is anonymous access. The compiler will require to override the construction function. That is for the return value. The case for the argument depends. Again anonymous access type is more handy but if you going to copy/store references, then named types are better. > Why not all named or all anonymous ? My rough rule is like this: Do not expose access types if you can. If you successfully hidden them either completely or by declaring them private, then named they go. If you exposed access types, then anonymous access is usually a better choice because it is easier to use, especially when access is merely to work around language limitations on argument/result passing (unconstrained object, access rules nightmare) AKA closures. Then it much is safer in a hierarchy of types and it is more use-clause friendly. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
Le 07/09/2023 à 18:18, Jeffrey R.Carter a écrit :
> On 2023-09-07 18:06, Blady wrote:
>>
>> Why choosing named access for New_BorderLayout and anonymous access
>> for AddLayoutComponent or GetLayoutComponent for the type of
>> parameters P1_xxx and the return type?
>
> It's very poor design to have access types in the visible part of a
> non-private pkg spec.
>
Hello Jeff,
I got you point :-)
But, in this specific case, I was wondering why not writing all with
named access or all with anonymous access?
Pascal.
On 2023-09-07 18:06, Blady wrote:
>
> Why choosing named access for New_BorderLayout and anonymous access for
> AddLayoutComponent or GetLayoutComponent for the type of parameters P1_xxx and
> the return type?
It's very poor design to have access types in the visible part of a non-private
pkg spec.
--
Jeff Carter
"This language [Ada] has a remarkable power of expressiveness,
something vital to the rapid development of complicated software,
and its 'strong typing' makes it easy to debug and modify."
Scott and Bagheri
160
Le 06/09/2023 à 17:54, Dmitry A. Kazakov a écrit :
> On 2023-09-06 16:37, Blady wrote:
>
>> I'm wondering about named access and anonymous access.
>> In the following Ada code, are the writing of parameter P1 type of
>> procedures PA and PB equivalent ?
>>
>> package C1 is
>> type Inst is tagged null record;
>> type Class is access all Inst'Class;
>> end C1;
>>
>> with C1;
>> package C2 is
>> type Inst is tagged null record;
>> type Class is access all Inst'Class;
>>
>> procedure PA (Self : Inst; P1 : C1.Class); -- named access
>> procedure PB (Self : Inst; P1 : access C1.Inst'Class); -- anonymous
>> access
>> end C2;
>>
>> Same with:
>> function FA (Self : Inst) return C1.Class; -- named access
>> function FB (Self : Inst) return access C1.Inst'Class; -- anonymous
>> access
>>
>> Are FA and FB writing equivalent?
>> If not why?
>
> They are not equivalent from the access checks point of view:
>
> declare
> Y : C2.Inst;
> X : aliased C1.Inst;
> begin
> C2.PA (Y, X'Access); -- Non-local pointer error
> C2.PB (Y, X'Access); -- Fine
> end;
>
> Furthermore, tagged anonymous access is controlling (dispatches) when
> not class-wide.
>
Thanks Dmitry, also Gautier and Jeff for your previous answers,
Well, I was questioning myself about the choice between named access and
anonymous access in the old Ada port of Java library, for instance:
type Typ;
type Ref is access all Typ'Class;
type Typ(LayoutManager2_I : Java.Awt.LayoutManager2.Ref;
Serializable_I : Java.Io.Serializable.Ref)
is new Java.Lang.Object.Typ
with null record;
------------------------------
-- Constructor Declarations --
------------------------------
function New_BorderLayout (This : Ref := null)
return Ref;
function New_BorderLayout (P1_Int : Java.Int;
P2_Int : Java.Int;
This : Ref := null)
return Ref;
-------------------------
-- Method Declarations --
-------------------------
procedure AddLayoutComponent (This : access Typ;
P1_Component : access
Standard.Java.Awt.Component.Typ'Class;
P2_Object : access
Standard.Java.Lang.Object.Typ'Class);
function GetLayoutComponent (This : access Typ;
P1_Object : access
Standard.Java.Lang.Object.Typ'Class)
return access Java.Awt.Component.Typ'Class;
Why choosing named access for New_BorderLayout and anonymous access for
AddLayoutComponent or GetLayoutComponent for the type of parameters
P1_xxx and the return type?
Why not all named or all anonymous ?
Thanks, Pascal.
On 2023-09-07 01:32, Ben Bacarisse wrote: > "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes: > >> On 2023-09-06 17:16, Ben Bacarisse wrote: >> >>> I am curious to know how reusable this is. Can the packages be >>> instantiated in such a way that the argument ranges over the elements >>> of, say, and Ordered_Map? >> >> Sure: >> >> with Ada.Containers.Ordered_Maps; >> >> package Integer_Maps is >> new Ada.Containers.Ordered_Maps (Integer, Integer); >> use Integer_Maps; >> package Cursor_Arguments is new Generic_Arguments (Cursor); > > Ah! So the arguments correspond to the "with" functions in the order > listed, and, since Cursor already has Next, there no need to specify > anything. Yes, because the formal argument is with function Next (Value : Argument_Type) return Argument_Type is <>; If it were with function Next (Value : Argument_Type) return Argument_Type; You would have to specify the actual. The part "is <>" tells to match a visible function Next. > There are a couple of details that prevent your Maximum_At function from > working properly in this case though. First, we can't have an empty > map, because X.Last can't be compared with X.First when either is > No_Element, so the test for Right < Left fails before the desired error > can be raised. Yes, cursors is bad idea, in the end they all are pointers. No_Element is an equivalent of null which shows. However Maximum_At will propagate Constraint_Error if either of the bounds is No_Element. So the implementation would work. > Second, if I try to use a Vector rather than an Ordered_Map, I am told > that: > > test2.adb:97:05: error: instantiation error at line 12 > test2.adb:97:05: error: no visible subprogram matches the specification for "<" > > It would seem that vector cursors can't be compared using < (at least by > default). Maybe the installation needs more arguments. Vector has a proper index type. All you have to do is. Given package Integer_Vectors is new Ada.Containers.Vectors (Integer, Integer); Wrap Element into a function: V : Integer_Vectors.Vector; function Element (Index : Integer) return Integer is begin return V.Element (Index); end Element; ... and use the wrapper. > Anyway, I am still not sure how to write a generic test for an empty > range. The problem is that the implementation of Cursor that breaks abstraction. The abstraction of an argument does not permit ideal non-values. Cursors and pointers have non-values. So if you want to test for non-values ahead, instead of surprising the function, you need to add a test for value validity to the abstraction: generic -- Ordered argument type Argument_Type is private; with function Valid (Value : Argument_Type) return Boolean is <>; ... package Generic_Arguments is Then you would pass Has_Element for it. For integers you would use wrapped X'Valid (there is no Integer'Valid, unfortunately. Only X'Valid where X is an object). > It's possible I was not clear about what I was aiming for. I was hoping > to be able to find the maximum of some arbitrary function, taking the > function's arguments from any sequential collection. That is a different abstraction. You need a generic collection instead of generic ordered values. E.g. generic with package Arguments is new Ada.Containers.Ordered_Sets (<>); with package Values is new Generic_Values (<>); package Generic_Comparable_Valued is use Arguments, Values; function Maximum_At ( Domain : Set; Func : access function (Argument : Element_Type) return Value_Type ) return Value_Type; -- Other useless functions end Generic_Comparable_Valued; package body Generic_Comparable_Valued is function Maximum_At ( Domain : Set; Func : access function (Argument : Element_Type) return Value_Type ) return Value_Type is Max : Value_Type; Value : Value_Type; Position : Cursor; begin if Domain.Is_Empty then raise Constraint_Error with "Empty set"; end if; Position := Domain.First; Max := Func (Element (Position)); while Position /= Domain.Last loop Position := Next (Position); Value := Func (Element (Position)); if Max < Value then Max := Value; end if; end loop; return Max; end Maximum_At; end Generic_Comparable_Valued; > Either a simple > range of values, an array or vector of values, a list of values or even > an ordered map of values -- any ordered list of values. In practice such abstraction have too much physical and mental overhead. E.g. large sets of values implemented differently from Ada.Containers.Ordered_Sets depending on the operations required. For example, let you need a set complement? Usually programmers simply stick with software patterns instead. Too much reliance of libraries make programs incoherent. > The bottom line is the last argument should be something very general > like the Period function. > > A fix (though it's not really ideal) would be to use function > composition here (inventing . as the composition operator): > > Map_Functions.Maximum_At (X.First, X.Last, Period'Access . Element'Access) > > but I don't think Ada has a function composition operator, does it? No as it would require closures. So you can have a generic composition operator, no problem, but not a first-class one. However you can simply add Maximum_At with four arguments to the package. > Another solution would be to write Maximum_At so that it knows it has a > cursor argument, but then I don't think it would work for native arrays, > would it? And we'd loose plain ranges altogether. You can write a generic package creating array cursors: generic type Index_Type is (<>); type Element_Type is private; type Array_Type is array (Index_Type range <>) of Element_Type; package Array_Cursors is type Cursor is private; function First (Container : Array_Type) return Cursor; function Element (Position : Cursor) return Element_Type; function "<" (Left, Right : Cursor) return Boolean; ... private package Dirty_Tricks is new System.Address_To_Access_Conversions (Array_Type); use Dirty_Tricks; type Cursor is record Domain : Object_Pointer; Index : Index_Type; end record; end Array_Cursors; package body Array_Cursors is function "<" (Left, Right : Cursor) return Boolean is begin if Left.Domain = null or else Left.Domain /= Right.Domain then raise Constraint_Error with "Incomparable cursors"; end if; return Left.Index < Right.Index; end "<"; function Element (Position : Cursor) return Element_Type is begin if Position.Domain = null or else Position.Index not in Position.Domain'Range then raise Constraint_Error with "Invalid cursor"; else return Position.Domain (Position.Index); end if; end Element; function First (Container : Array_Type) return Cursor is begin if Container'Length = 0 then raise Constraint_Error with "Empty array"; else return (To_Pointer (Container'Address), Container'First); end if; end First; end Array_Cursors; > But then (I think) the only function one could pass would be something > like Element as in you example above. Using an ordered set of integers > would not allow > > Map_Functions.Maximum_At (Set.First, Set.Last, Period'Access) > > would it? Ordered_Set cursors are ordered like Ordered_Map ones, so it should work. >>> I am asking you but I am also the group. I appreciate your help, >>> but don't want you to feel any obligation to keep helping! >> >> No problem. > > You seem to be on your own as far as helping out is concerned! Because it started as a numeric puzzle. You should have asked directly about generics or tagged types instead. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
On 2023-09-07 03:04, Randy Brukardt wrote: > "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message > news:uchukd$1lnvp$1@dont-email.me... >> On 2023-08-28 11:18, Stephen Davies wrote: >> > ... >> Neither there is one why 'Image must be a non-overridable attribute > > There actually is a good reason for this. Attributes have global visibility. > So if you allowed overriding of attributes, then a with added or removed in > a remote part of a program could silently change the behavior of code that > has no knowledge of of the change. That would be bad for "programming in the > large". Note that Ada 95 was proven to have no such cases, and we've tried > very hard to avoid them. Ah, but 'Image is for debugging only! (:-)) > One could imagine adding rather severe restrictions to overriding of > attributes to eliminate this problem (for instance, only allowing it for > primitive operations of the type), but that would eliminate all real value > of the feature (you can always use a primitive function and "use all" to get > the same effect without any new features). It must be a new type: type My_Integer is new Integer; for My_Integer'Image use Foo; -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
El dia dilluns, 4 de setembre de 2023 a les 11:19:53 UTC+2, CSYH (QAQ) va escriure: > I am new to Ada, I know is there a good way to start this program? > thanks > https://projecteuler.net/problem=26 Hi CSHY, Please take a look at my Euler tools repository, https://github.com/rocher/euler_tools (not the best math lib you'll find, I know). I used this library tools to solve problem 26 here: https://github.com/rocher/alice-project_euler-rocher Let me know what you think.
"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message news:uchukd$1lnvp$1@dont-email.me... > On 2023-08-28 11:18, Stephen Davies wrote: > ... >Neither there is one why 'Image must be a non-overridable attribute There actually is a good reason for this. Attributes have global visibility. So if you allowed overriding of attributes, then a with added or removed in a remote part of a program could silently change the behavior of code that has no knowledge of of the change. That would be bad for "programming in the large". Note that Ada 95 was proven to have no such cases, and we've tried very hard to avoid them. One could imagine adding rather severe restrictions to overriding of attributes to eliminate this problem (for instance, only allowing it for primitive operations of the type), but that would eliminate all real value of the feature (you can always use a primitive function and "use all" to get the same effect without any new features). For 'Image specifically, the design of the attribute doesn't work well for composition (for Image for composite types), which is why Ada 2022 has a separate attribute that can be overridden similar to a stream attribute. Randy.
On 2023-09-06 16:37, Blady wrote:
>
> I'm wondering about named access and anonymous access.
The rules for using access-to-object types are
1. Don't use access types
2. If you think you should use access types, see rule 1.
3. If you still think you should use access types, don't use anonymous access types
4. If you still think you should use anonymous access types, don't develop software
The semantics of named access types are well defined and easily understood. The
semantics of anonymous access types are defined in ARM 3.10.2, of which the AARM
says
"Subclause 3.10.2, home of the accessibility rules, is informally known as the
'Heart of Darkness' amongst the maintainers of Ada. Woe unto all who enter here
(well, at least unto anyone that needs to understand any of these rules)."
The ARG freely admits that no one understands 3.10.2, which means that what you
get when you use anonymous access types is whatever the compiler writer thinks
it says. This may differ between compilers and between different versions of the
same compiler, and from what you think it says.
So no sane person uses them.
--
Jeff Carter
“Companies who create critical applications—those
with a low tolerance for risk—would do well to use
Ada for those applications, even if they're more
familiar with other languages like C and C++.”
Mike Jelks
207
"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes: > On 2023-09-06 17:16, Ben Bacarisse wrote: > >> I am curious to know how reusable this is. Can the packages be >> instantiated in such a way that the argument ranges over the elements >> of, say, and Ordered_Map? > > Sure: > > with Ada.Containers.Ordered_Maps; > > package Integer_Maps is > new Ada.Containers.Ordered_Maps (Integer, Integer); > use Integer_Maps; > package Cursor_Arguments is new Generic_Arguments (Cursor); Ah! So the arguments correspond to the "with" functions in the order listed, and, since Cursor already has Next, there no need to specify anything. One could (I've just tried) use => notation. You could have written package Arguments is new Generic_Arguments (Next => Positive'Succ, Argument_Type => Positive); in your first example -- swapping the order just to make the point obvious. This tripped me up when I was playing around with a Cursors solution. There are a couple of details that prevent your Maximum_At function from working properly in this case though. First, we can't have an empty map, because X.Last can't be compared with X.First when either is No_Element, so the test for Right < Left fails before the desired error can be raised. Second, if I try to use a Vector rather than an Ordered_Map, I am told that: test2.adb:97:05: error: instantiation error at line 12 test2.adb:97:05: error: no visible subprogram matches the specification for "<" It would seem that vector cursors can't be compared using < (at least by default). Maybe the installation needs more arguments. Anyway, I am still not sure how to write a generic test for an empty range. > package Map_Values is new Generic_Values (Integer); > package Map_Functions is > new Generic_Discrete_Comparable_Valued > (Cursor_Arguments, Map_Values); > > Then given X is a map: X : Map; > > Map_Functions.Maximum_At (X.First, X.Last, Element'Access) It's possible I was not clear about what I was aiming for. I was hoping to be able to find the maximum of some arbitrary function, taking the function's arguments from any sequential collection. Either a simple range of values, an array or vector of values, a list of values or even an ordered map of values -- any ordered list of values. The bottom line is the last argument should be something very general like the Period function. A fix (though it's not really ideal) would be to use function composition here (inventing . as the composition operator): Map_Functions.Maximum_At (X.First, X.Last, Period'Access . Element'Access) but I don't think Ada has a function composition operator, does it? Another solution would be to write Maximum_At so that it knows it has a cursor argument, but then I don't think it would work for native arrays, would it? And we'd loose plain ranges altogether. >> Maybe a more generic a solution would involve passing something that can >> be iterated over, rather than two values of an "enumerated" type? I >> mean enumerated in the mathematical sense -- it may be the wrong word in >> Ada. > > Yes, but Ada does not have built-in range types. Therefore such design will > not work out of the box with discrete types because 2..999 is not a proper > object in Ada. However, talking about abstractions, you can create an > interval type for the purpose or else use an ordered set of integers. But then (I think) the only function one could pass would be something like Element as in you example above. Using an ordered set of integers would not allow Map_Functions.Maximum_At (Set.First, Set.Last, Period'Access) would it? >> I am asking you but I am also the group. I appreciate your help, >> but don't want you to feel any obligation to keep helping! > > No problem. You seem to be on your own as far as helping out is concerned! -- Ben.
> In the following Ada code, are the writing of parameter P1 type of
> procedures PA and PB equivalent ?
They are not equivalent because the anonymous access opens more possibilities (example below), but you are certainly aware of that.
So I guess you have another question in mind...
with C1, C2;
procedure test is
x2 : C2.Inst;
type My_Reference_1 is access all C1.Inst'Class;
r1 : My_Reference_1;
begin
x2.PB (r1);
x2.PA (r1);
-- ^ expected type "Class" defined at c1.ads:3
-- found type "My_Reference_1" defined at line 6
end;
On 2023-09-06 17:16, Ben Bacarisse wrote: > I am curious to know how reusable this is. Can the packages be > instantiated in such a way that the argument ranges over the elements > of, say, and Ordered_Map? Sure: with Ada.Containers.Ordered_Maps; package Integer_Maps is new Ada.Containers.Ordered_Maps (Integer, Integer); use Integer_Maps; package Cursor_Arguments is new Generic_Arguments (Cursor); package Map_Values is new Generic_Values (Integer); package Map_Functions is new Generic_Discrete_Comparable_Valued (Cursor_Arguments, Map_Values); Then given X is a map: X : Map; Map_Functions.Maximum_At (X.First, X.Last, Element'Access) > Maybe a more generic a solution would involve passing something that can > be iterated over, rather than two values of an "enumerated" type? I > mean enumerated in the mathematical sense -- it may be the wrong word in > Ada. Yes, but Ada does not have built-in range types. Therefore such design will not work out of the box with discrete types because 2..999 is not a proper object in Ada. However, talking about abstractions, you can create an interval type for the purpose or else use an ordered set of integers. > I am asking you but I am also the group. I appreciate your help, > but don't want you to feel any obligation to keep helping! No problem. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
On 2023-09-06 16:37, Blady wrote: > I'm wondering about named access and anonymous access. > In the following Ada code, are the writing of parameter P1 type of > procedures PA and PB equivalent ? > > package C1 is > type Inst is tagged null record; > type Class is access all Inst'Class; > end C1; > > with C1; > package C2 is > type Inst is tagged null record; > type Class is access all Inst'Class; > > procedure PA (Self : Inst; P1 : C1.Class); -- named access > procedure PB (Self : Inst; P1 : access C1.Inst'Class); -- anonymous > access > end C2; > > Same with: > function FA (Self : Inst) return C1.Class; -- named access > function FB (Self : Inst) return access C1.Inst'Class; -- anonymous > access > > Are FA and FB writing equivalent? > If not why? They are not equivalent from the access checks point of view: declare Y : C2.Inst; X : aliased C1.Inst; begin C2.PA (Y, X'Access); -- Non-local pointer error C2.PB (Y, X'Access); -- Fine end; Furthermore, tagged anonymous access is controlling (dispatches) when not class-wide. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes: > On 2023-09-06 03:10, Ben Bacarisse wrote: >> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes: >> >>> On 2023-09-05 17:18, Ben Bacarisse wrote: >>> >>>> There was >>>> boiler plate code in my program that could be abstracted out into a >>>> generic function (or package?) so that any function can be maximised >>>> over some range or, better yet, any iterable type (if that's how Ada >>>> does things). >>> >>>> Can someone here show me how? >>> >>> You define some classes. Either generic or tagged. E.g. a generic class of >>> functions that uses two generic classes of the argument and the value: >>> >>> generic >>> -- Ordered argument >>> type Argument_Type is private; >>> with function Next (Value : Argument_Type) >>> return Argument_Type is <>; >>> with function "<" (Left, Right : Argument_Type) >>> return Boolean is <>; >>> with function "=" (Left, Right : Argument_Type) >>> return Boolean is <>; >>> -- Comparable value >>> type Value_Type is private; >>> with function "<" (Left, Right : Value_Type ) return Boolean is <>; >>> -- Function type >>> with function Func (Argument : Argument_Type) return Value_Type; >>> function Generic_Maximum_At (Left, Right : Argument_Type) >>> return Value_Type; >>> >>> and the implementation >>> >>> function Generic_Maximum_At (Left, Right : Argument_Type) >>> return Value_Type is >>> Argument : Argument_Type := Left; >>> Max : Value_Type; >>> Value : Value_Type; >>> begin >>> if Right < Left then >>> raise Constraint_Error with "Empty interval"; >>> end if; >>> Max := Func (Argument); >>> while not (Argument = Right) loop >>> Argument := Next (Argument); >>> Value := Func (Argument); >>> if Max < Value then >>> Max := Value; >>> end if; >>> end loop; >>> return Max; >>> end Generic_Maximum_At; >>> >>> or you can choose to pass the function as an argument: >>> >>> generic >>> -- Ordered argument >>> type Argument_Type is private; >>> with function Next (Value : Argument_Type) >>> return Argument_Type is <>; >>> with function "<" (Left, Right : Argument_Type) >>> return Boolean is <>; >>> -- Comparable value >>> type Value_Type is private; >>> with function "<" (Left, Right : Value_Type) return Boolean is <>; >>> function Generic_Maximum_At >>> ( Left, Right : Argument_Type; >>> Func : access function (Argument : Argument_Type) >>> return Value_Type >>> ) return Value_Type; >>> >>> Or you can make it a package which is usually a better choice as one can >>> pack into it several entities sharing the same generic interface: >>> >>> generic >>> -- Ordered argument >>> type Argument_Type is private; >>> with function Next (Value : Argument_Type) >>> return Argument_Type is <>; >>> with function "<" (Left, Right : Argument_Type ) >>> return Boolean is <>; >>> with function "=" (Left, Right : Argument_Type) >>> return Boolean is <>; >>> -- Comparable value >>> type Value_Type is private; >>> with function "<" (Left, Right : Value_Type) return Boolean is <>; >>> package Generic_Discrete_Comparable_Valued is >>> function Maximum_At >>> ( Left, Right : Argument_Type; >>> Func : access function (Argument : Argument_Type) >>> return Value_Type >>> ) return Value_Type; >>> -- Other useless functions >>> end Generic_Discrete_Comparable_Valued; >>> >>> The generic classes of arguments/values can be in turn factored out into >>> reusable generic packages: >>> >>> generic >>> -- Ordered argument >>> type Argument_Type is private; >>> with function Next (Value : Argument_Type) return Argument_Type is <>; >>> with function "<" (Left, Right : Argument_Type) return Boolean is <>; >>> with function "=" (Left, Right : Argument_Type) return Boolean is <>; >>> package Generic_Arguments is >>> end Generic_Arguments; >>> >>> generic >>> -- Comparable value >>> type Value_Type is private; >>> with function "<" (Left, Right : Value_Type ) return Boolean is <>; >>> package Generic_Values is >>> end Generic_Values; >>> >>> generic >>> with package Arguments is new Generic_Arguments (<>); >>> with package Values is new Generic_Values (<>); >>> package Generic_Discrete_Comparable_Valued is >>> use Arguments, Values; >>> function Maximum_At >>> ( Left, Right : Argument_Type; >>> Func : access function (Argument : Argument_Type) >>> return Value_Type >>> ) return Value_Type; >>> -- Other useless functions >>> end Generic_Discrete_Comparable_Valued; >> Thank you. I can't yet see how to use any of these alternatives, but >> that's my problem. > > It is pretty much straightforward. E.g. the last one: Sure, but I am new to Ada. Well actually I first wrote Ada in the early 80s, but the project didn't go with Ada (too new I suspect) so reading one book was the extent of my learning. > package Arguments is new Generic_Arguments (Integer, Integer'Succ); > package Values is new Generic_Values (Integer); I'd probably choose more generic names for the packages since these are more general than the names suggest. I might go with Generic_Enumerated (since it has 'Next') and Generic_Ordered. Just to test I knew what was going on, I changed 'while not (Argument = Right)' to 'while Argument < Right' so as to remove the need for having an "=" function. I doubt there are any types with "<" but not "=" but I wanted to confirm I understood the code. > package Functions is > new Generic_Discrete_Comparable_Valued (Arguments, Values); > > > Now you can print the maximum of your Period function: > > Put_Line > ( "Max at" > & Integer'Image (Functions.Maximum_At (2, 999, Period'Access)) > ); Thanks. (A minor issue: to meet the specification we either need 1000 here or the loop needs to be changed to include the upper bound (like the for loop did in the original). Whilst it's easy to pass "one past the top index" for Integer and so on, if the code can be made more generic it would have to use all the values in the range because Ada has not done the C++ hack of having XXX.end() be an iterator "one past" the actual end of a range.) I am curious to know how reusable this is. Can the packages be instantiated in such a way that the argument ranges over the elements of, say, and Ordered_Map? In some languages (C++!) one could pass a pair of iterators here (cursors, I think in Ada-speak). I tried to do that but I don't think Ada's cursors are ordered by < though they do have a Next function. And if that method does work (it's quite likely it was only my ignorance of the language that stopped it working) would it work for built-in arrays which don't seem to have cursors. Maybe a more generic a solution would involve passing something that can be iterated over, rather than two values of an "enumerated" type? I mean enumerated in the mathematical sense -- it may be the wrong word in Ada. I am asking you but I am also the group. I appreciate your help, but don't want you to feel any obligation to keep helping! >> Are there any good online sources on Ada generic >> programming so I can find out how to implement and use this short of >> package? > > Actually I provided an implementation above. Here it is again: Sorry, missed that first time round. -- Ben.
Hello, I'm wondering about named access and anonymous access. In the following Ada code, are the writing of parameter P1 type of procedures PA and PB equivalent ? package C1 is type Inst is tagged null record; type Class is access all Inst'Class; end C1; with C1; package C2 is type Inst is tagged null record; type Class is access all Inst'Class; procedure PA (Self : Inst; P1 : C1.Class); -- named access procedure PB (Self : Inst; P1 : access C1.Inst'Class); -- anonymous access end C2; Same with: function FA (Self : Inst) return C1.Class; -- named access function FB (Self : Inst) return access C1.Inst'Class; -- anonymous access Are FA and FB writing equivalent? If not why? Thanks, Pascal.
Hello, Here is a very preliminary version of GNAT Studio 24.0wa as a stand alone app for macOS 13: https://sourceforge.net/projects/gnuada/files/GNAT_GPL%20Mac%20OS%20X/2023-ventura See readme for details. Limitation: Ada Language Server has some latencies and doesn't respond when parsing source code with more 2000 lines. It may be due to some compilation options I missed. There could be some other limitations that you might meet. Feel free to report them on MacAda list (http://hermes.gwu.edu/archives/gnat-osx.html). Any help will be really appreciated to fix these limitations. Enjoy, Pascal.
On 2023-09-06 03:10, Ben Bacarisse wrote: > "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes: > >> On 2023-09-05 17:18, Ben Bacarisse wrote: >> >>> There was >>> boiler plate code in my program that could be abstracted out into a >>> generic function (or package?) so that any function can be maximised >>> over some range or, better yet, any iterable type (if that's how Ada >>> does things). >> >>> Can someone here show me how? >> >> You define some classes. Either generic or tagged. E.g. a generic class of >> functions that uses two generic classes of the argument and the value: >> >> generic >> -- Ordered argument >> type Argument_Type is private; >> with function Next (Value : Argument_Type) >> return Argument_Type is <>; >> with function "<" (Left, Right : Argument_Type) >> return Boolean is <>; >> with function "=" (Left, Right : Argument_Type) >> return Boolean is <>; >> -- Comparable value >> type Value_Type is private; >> with function "<" (Left, Right : Value_Type ) return Boolean is <>; >> -- Function type >> with function Func (Argument : Argument_Type) return Value_Type; >> function Generic_Maximum_At (Left, Right : Argument_Type) >> return Value_Type; >> >> and the implementation >> >> function Generic_Maximum_At (Left, Right : Argument_Type) >> return Value_Type is >> Argument : Argument_Type := Left; >> Max : Value_Type; >> Value : Value_Type; >> begin >> if Right < Left then >> raise Constraint_Error with "Empty interval"; >> end if; >> Max := Func (Argument); >> while not (Argument = Right) loop >> Argument := Next (Argument); >> Value := Func (Argument); >> if Max < Value then >> Max := Value; >> end if; >> end loop; >> return Max; >> end Generic_Maximum_At; >> >> or you can choose to pass the function as an argument: >> >> generic >> -- Ordered argument >> type Argument_Type is private; >> with function Next (Value : Argument_Type) >> return Argument_Type is <>; >> with function "<" (Left, Right : Argument_Type) >> return Boolean is <>; >> -- Comparable value >> type Value_Type is private; >> with function "<" (Left, Right : Value_Type) return Boolean is <>; >> function Generic_Maximum_At >> ( Left, Right : Argument_Type; >> Func : access function (Argument : Argument_Type) >> return Value_Type >> ) return Value_Type; >> >> Or you can make it a package which is usually a better choice as one can >> pack into it several entities sharing the same generic interface: >> >> generic >> -- Ordered argument >> type Argument_Type is private; >> with function Next (Value : Argument_Type) >> return Argument_Type is <>; >> with function "<" (Left, Right : Argument_Type ) >> return Boolean is <>; >> with function "=" (Left, Right : Argument_Type) >> return Boolean is <>; >> -- Comparable value >> type Value_Type is private; >> with function "<" (Left, Right : Value_Type) return Boolean is <>; >> package Generic_Discrete_Comparable_Valued is >> function Maximum_At >> ( Left, Right : Argument_Type; >> Func : access function (Argument : Argument_Type) >> return Value_Type >> ) return Value_Type; >> -- Other useless functions >> end Generic_Discrete_Comparable_Valued; >> >> The generic classes of arguments/values can be in turn factored out into >> reusable generic packages: >> >> generic >> -- Ordered argument >> type Argument_Type is private; >> with function Next (Value : Argument_Type) return Argument_Type is <>; >> with function "<" (Left, Right : Argument_Type) return Boolean is <>; >> with function "=" (Left, Right : Argument_Type) return Boolean is <>; >> package Generic_Arguments is >> end Generic_Arguments; >> >> generic >> -- Comparable value >> type Value_Type is private; >> with function "<" (Left, Right : Value_Type ) return Boolean is <>; >> package Generic_Values is >> end Generic_Values; >> >> generic >> with package Arguments is new Generic_Arguments (<>); >> with package Values is new Generic_Values (<>); >> package Generic_Discrete_Comparable_Valued is >> use Arguments, Values; >> function Maximum_At >> ( Left, Right : Argument_Type; >> Func : access function (Argument : Argument_Type) >> return Value_Type >> ) return Value_Type; >> -- Other useless functions >> end Generic_Discrete_Comparable_Valued; > > Thank you. I can't yet see how to use any of these alternatives, but > that's my problem. It is pretty much straightforward. E.g. the last one: package Arguments is new Generic_Arguments (Integer, Integer'Succ); package Values is new Generic_Values (Integer); package Functions is new Generic_Discrete_Comparable_Valued (Arguments, Values); Now you can print the maximum of your Period function: Put_Line ( "Max at" & Integer'Image (Functions.Maximum_At (2, 999, Period'Access)) ); > Are there any good online sources on Ada generic > programming so I can find out how to implement and use this short of > package? Actually I provided an implementation above. Here it is again: package body Generic_Discrete_Comparable_Valued is function Maximum_At ( Left, Right : Argument_Type; Func : access function (Argument : Argument_Type) return Value_Type ) return Value_Type is Argument : Argument_Type := Left; Max : Value_Type; Value : Value_Type; begin if Right < Left then raise Constraint_Error with "Empty interval"; end if; Max := Func (Argument); while not (Argument = Right) loop Argument := Next (Argument); Value := Func (Argument); if Max < Value then Max := Value; end if; end loop; return Max; end Maximum_At; end Generic_Discrete_Comparable_Valued; (The packages Generic_Arguments and Generic_Values have no bodies) -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes:
> On 2023-09-05 17:18, Ben Bacarisse wrote:
>
>> There was
>> boiler plate code in my program that could be abstracted out into a
>> generic function (or package?) so that any function can be maximised
>> over some range or, better yet, any iterable type (if that's how Ada
>> does things).
>
>> Can someone here show me how?
>
> You define some classes. Either generic or tagged. E.g. a generic class of
> functions that uses two generic classes of the argument and the value:
>
> generic
> -- Ordered argument
> type Argument_Type is private;
> with function Next (Value : Argument_Type)
> return Argument_Type is <>;
> with function "<" (Left, Right : Argument_Type)
> return Boolean is <>;
> with function "=" (Left, Right : Argument_Type)
> return Boolean is <>;
> -- Comparable value
> type Value_Type is private;
> with function "<" (Left, Right : Value_Type ) return Boolean is <>;
> -- Function type
> with function Func (Argument : Argument_Type) return Value_Type;
> function Generic_Maximum_At (Left, Right : Argument_Type)
> return Value_Type;
>
> and the implementation
>
> function Generic_Maximum_At (Left, Right : Argument_Type)
> return Value_Type is
> Argument : Argument_Type := Left;
> Max : Value_Type;
> Value : Value_Type;
> begin
> if Right < Left then
> raise Constraint_Error with "Empty interval";
> end if;
> Max := Func (Argument);
> while not (Argument = Right) loop
> Argument := Next (Argument);
> Value := Func (Argument);
> if Max < Value then
> Max := Value;
> end if;
> end loop;
> return Max;
> end Generic_Maximum_At;
>
> or you can choose to pass the function as an argument:
>
> generic
> -- Ordered argument
> type Argument_Type is private;
> with function Next (Value : Argument_Type)
> return Argument_Type is <>;
> with function "<" (Left, Right : Argument_Type)
> return Boolean is <>;
> -- Comparable value
> type Value_Type is private;
> with function "<" (Left, Right : Value_Type) return Boolean is <>;
> function Generic_Maximum_At
> ( Left, Right : Argument_Type;
> Func : access function (Argument : Argument_Type)
> return Value_Type
> ) return Value_Type;
>
> Or you can make it a package which is usually a better choice as one can
> pack into it several entities sharing the same generic interface:
>
> generic
> -- Ordered argument
> type Argument_Type is private;
> with function Next (Value : Argument_Type)
> return Argument_Type is <>;
> with function "<" (Left, Right : Argument_Type )
> return Boolean is <>;
> with function "=" (Left, Right : Argument_Type)
> return Boolean is <>;
> -- Comparable value
> type Value_Type is private;
> with function "<" (Left, Right : Value_Type) return Boolean is <>;
> package Generic_Discrete_Comparable_Valued is
> function Maximum_At
> ( Left, Right : Argument_Type;
> Func : access function (Argument : Argument_Type)
> return Value_Type
> ) return Value_Type;
> -- Other useless functions
> end Generic_Discrete_Comparable_Valued;
>
> The generic classes of arguments/values can be in turn factored out into
> reusable generic packages:
>
> generic
> -- Ordered argument
> type Argument_Type is private;
> with function Next (Value : Argument_Type) return Argument_Type is <>;
> with function "<" (Left, Right : Argument_Type) return Boolean is <>;
> with function "=" (Left, Right : Argument_Type) return Boolean is <>;
> package Generic_Arguments is
> end Generic_Arguments;
>
> generic
> -- Comparable value
> type Value_Type is private;
> with function "<" (Left, Right : Value_Type ) return Boolean is <>;
> package Generic_Values is
> end Generic_Values;
>
> generic
> with package Arguments is new Generic_Arguments (<>);
> with package Values is new Generic_Values (<>);
> package Generic_Discrete_Comparable_Valued is
> use Arguments, Values;
> function Maximum_At
> ( Left, Right : Argument_Type;
> Func : access function (Argument : Argument_Type)
> return Value_Type
> ) return Value_Type;
> -- Other useless functions
> end Generic_Discrete_Comparable_Valued;
Thank you. I can't yet see how to use any of these alternatives, but
that's my problem. Are there any good online sources on Ada generic
programming so I can find out how to implement and use this short of
package?
--
Ben.
On 05/09/2023 08:23, Dmitry A. Kazakov wrote: > On 2023-09-05 01:16, Ben Bacarisse wrote: > >> The term "abstraction" is usually taken to be more general than that so >> as to include function (or procedural) abstraction. > > These are means of software decomposition rather than abstraction (of > something). They are both of these things, actually. > >> Ada is good at that, but the syntax is sufficiently cumbersome that I >> think it discourages people from exploiting that part of the language. >> Mind you, I am no Ada expert so maybe it's simpler to do than I think. > > If the program does not resemble electric transmission noise, some > people call the language syntax cumbersome... (:-)) 8-) >> Here's my Ada solution: >> >> with Ada.Text_IO; use Ada.Text_IO; >> with Ada.Containers.Ordered_Maps; use Ada.Containers; >> >> procedure Euler_26 is >> >> function Period(Divisor: Positive) return Positive is > > You cannot use a number here because the period may have leading zeros. > >> I know it won't make this program shorter, but it would be interesting >> to know how it might be done. > > The goal of engineering is not making programs shorter, it is to make > them understandable, safer, reusable, maintainable, extensible, integrable. Hear, hear! Functionalists do seem to have an obsession with brevity at all costs. It's very strange. -- Bill F.
On 2023-09-05 17:18, Ben Bacarisse wrote: > There was > boiler plate code in my program that could be abstracted out into a > generic function (or package?) so that any function can be maximised > over some range or, better yet, any iterable type (if that's how Ada > does things). > Can someone here show me how? You define some classes. Either generic or tagged. E.g. a generic class of functions that uses two generic classes of the argument and the value: generic -- Ordered argument type Argument_Type is private; with function Next (Value : Argument_Type) return Argument_Type is <>; with function "<" (Left, Right : Argument_Type) return Boolean is <>; with function "=" (Left, Right : Argument_Type) return Boolean is <>; -- Comparable value type Value_Type is private; with function "<" (Left, Right : Value_Type ) return Boolean is <>; -- Function type with function Func (Argument : Argument_Type) return Value_Type; function Generic_Maximum_At (Left, Right : Argument_Type) return Value_Type; and the implementation function Generic_Maximum_At (Left, Right : Argument_Type) return Value_Type is Argument : Argument_Type := Left; Max : Value_Type; Value : Value_Type; begin if Right < Left then raise Constraint_Error with "Empty interval"; end if; Max := Func (Argument); while not (Argument = Right) loop Argument := Next (Argument); Value := Func (Argument); if Max < Value then Max := Value; end if; end loop; return Max; end Generic_Maximum_At; or you can choose to pass the function as an argument: generic -- Ordered argument type Argument_Type is private; with function Next (Value : Argument_Type) return Argument_Type is <>; with function "<" (Left, Right : Argument_Type) return Boolean is <>; -- Comparable value type Value_Type is private; with function "<" (Left, Right : Value_Type) return Boolean is <>; function Generic_Maximum_At ( Left, Right : Argument_Type; Func : access function (Argument : Argument_Type) return Value_Type ) return Value_Type; Or you can make it a package which is usually a better choice as one can pack into it several entities sharing the same generic interface: generic -- Ordered argument type Argument_Type is private; with function Next (Value : Argument_Type) return Argument_Type is <>; with function "<" (Left, Right : Argument_Type ) return Boolean is <>; with function "=" (Left, Right : Argument_Type) return Boolean is <>; -- Comparable value type Value_Type is private; with function "<" (Left, Right : Value_Type) return Boolean is <>; package Generic_Discrete_Comparable_Valued is function Maximum_At ( Left, Right : Argument_Type; Func : access function (Argument : Argument_Type) return Value_Type ) return Value_Type; -- Other useless functions end Generic_Discrete_Comparable_Valued; The generic classes of arguments/values can be in turn factored out into reusable generic packages: generic -- Ordered argument type Argument_Type is private; with function Next (Value : Argument_Type) return Argument_Type is <>; with function "<" (Left, Right : Argument_Type) return Boolean is <>; with function "=" (Left, Right : Argument_Type) return Boolean is <>; package Generic_Arguments is end Generic_Arguments; generic -- Comparable value type Value_Type is private; with function "<" (Left, Right : Value_Type ) return Boolean is <>; package Generic_Values is end Generic_Values; generic with package Arguments is new Generic_Arguments (<>); with package Values is new Generic_Values (<>); package Generic_Discrete_Comparable_Valued is use Arguments, Values; function Maximum_At ( Left, Right : Argument_Type; Func : access function (Argument : Argument_Type) return Value_Type ) return Value_Type; -- Other useless functions end Generic_Discrete_Comparable_Valued; -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes: > On 2023-09-05 01:16, Ben Bacarisse wrote: > >> The term "abstraction" is usually taken to be more general than that so >> as to include function (or procedural) abstraction. > > These are means of software decomposition rather than abstraction (of > something). That's not how the word is usually used. Obviously I can't (and don't want to) change your mind, but algorithms can be abstracted as well as data. I was hoping someone could how me how in for the example program I gave since that's an area of Ada I am not familiar with (but I's sure it's possible). >> Ada is good at that, but the syntax is sufficiently cumbersome that I >> think it discourages people from exploiting that part of the language. >> Mind you, I am no Ada expert so maybe it's simpler to do than I think. > > If the program does not resemble electric transmission noise, some people > call the language syntax cumbersome... (:-)) That's true. But there are also constructs that are genuinely cumbersome in some languages. Anyway, to find out more, I was hoping someone would show me what it looks like in Ada -- I outlined what I wanted to do after the code I posted. >> Here's my Ada solution: >> with Ada.Text_IO; use Ada.Text_IO; >> with Ada.Containers.Ordered_Maps; use Ada.Containers; >> procedure Euler_26 is >> function Period(Divisor: Positive) return Positive is > > You cannot use a number here because the period may have leading > zeros. The function returns the decimal period of 1/Divisor. I don't believe there is a bug, but if you think you've found one, I'd like to know about it. Of course there can be leading zeros, but my algorithm ignores the digits and determines the period using the "carry" instead. >> I know it won't make this program shorter, but it would be interesting >> to know how it might be done. > > The goal of engineering is not making programs shorter, it is to make them > understandable, safer, reusable, maintainable, extensible, integrable. Yes. That's exactly why I was asking for someone who knows Ada better to show me how to write the reusable component I described. There was boiler plate code in my program that could be abstracted out into a generic function (or package?) so that any function can be maximised over some range or, better yet, any iterable type (if that's how Ada does things). Can someone here show me how? -- Ben.
On 2023-09-05 01:16, Ben Bacarisse wrote: > The term "abstraction" is usually taken to be more general than that so > as to include function (or procedural) abstraction. These are means of software decomposition rather than abstraction (of something). > Ada is good at that, but the syntax is sufficiently cumbersome that I > think it discourages people from exploiting that part of the language. > Mind you, I am no Ada expert so maybe it's simpler to do than I think. If the program does not resemble electric transmission noise, some people call the language syntax cumbersome... (:-)) > Here's my Ada solution: > > with Ada.Text_IO; use Ada.Text_IO; > with Ada.Containers.Ordered_Maps; use Ada.Containers; > > procedure Euler_26 is > > function Period(Divisor: Positive) return Positive is You cannot use a number here because the period may have leading zeros. > I know it won't make this program shorter, but it would be interesting > to know how it might be done. The goal of engineering is not making programs shorter, it is to make them understandable, safer, reusable, maintainable, extensible, integrable. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes: > On 2023-09-04 22:18, Ben Bacarisse wrote: >> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes: >> >>> On 2023-09-04 18:01, Ben Bacarisse wrote: >>>> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes: >>>> >>>>> BTW, Ada is perfect for numeric algorithms no need to resort to functional >>>>> mess... (:-)) >>>> Perfect? That's a bold claim! >>> >>> Ada is a very improved descendant of Algol 60, which was designed to codify >>> algorithms. >> Yes, though I was respond to you narrower remark about being perfect for >> numeric algorithms. > > Yes, Ada is. :-) >>> (rather than about for example building >>> abstractions as in the case of OOP) >> >> That's interesting. You don't consider using functions and procedures >> (possibly higher-order ones) to be a way to build abstractions? > > No, they do not introduce new types and do not form some structure of their > values. And "using" is not an abstraction anyway. The term "abstraction" is usually taken to be more general than that so as to include function (or procedural) abstraction. Ada is good at that, but the syntax is sufficiently cumbersome that I think it discourages people from exploiting that part of the language. Mind you, I am no Ada expert so maybe it's simpler to do than I think. Here's my Ada solution: with Ada.Text_IO; use Ada.Text_IO; with Ada.Containers.Ordered_Maps; use Ada.Containers; procedure Euler_26 is function Period(Divisor: Positive) return Positive is Index: Natural := 0; Carry: Natural := 1; package Carry_Maps is new Ordered_Maps(Natural, Natural); use Carry_Maps; Carries: Map; Loc: Cursor; begin loop Loc := Carries.Find(Carry); exit when Loc /= No_Element; Carries.Insert(Carry, Index); Index := Index + 1; Carry := Carry mod Divisor * 10; end loop; return Index - Element(Loc); end Period; Max_Period: Natural := 1; Divisor_With_Max_Period: Natural := 1; begin for D in 2..999 loop declare Ds_Period: constant Positive := Period(D); begin if Ds_Period > Max_Period then Divisor_With_Max_Period := D; Max_Period := Ds_Period; end if; end; end loop; Put_Line(Integer'Image(Divisor_With_Max_Period)); end Euler_26; The part that finds the D that maximises Period(D) is just boilerplate code. I know this can be abstracted out in Ada, but I think the syntax is messy. I was hoping to find (or be able to write) a generic function that takes an 'iterable' (if that's the right word) and a function, and which returns the element that maximises the function. I got stuck trying. Maybe someone can help? I know it won't make this program shorter, but it would be interesting to know how it might be done. -- Ben.
On 2023-09-04 22:18, Ben Bacarisse wrote: > "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes: > >> On 2023-09-04 18:01, Ben Bacarisse wrote: >>> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes: >>> >>>> BTW, Ada is perfect for numeric algorithms no need to resort to functional >>>> mess... (:-)) >>> Perfect? That's a bold claim! >> >> Ada is a very improved descendant of Algol 60, which was designed to codify >> algorithms. > > Yes, though I was respond to you narrower remark about being perfect for > numeric algorithms. Yes, Ada is. > Are you expending that to perfect for every kind of > algorithm? Algorithms are defined in terms of established types, e.g. model numbers or other well known structures. Ada works pretty good for non-numeric algorithms too. So well, that many Ada programmers never go beyond this stage and proclaim anathema to anything above it. >> (rather than about for example building >> abstractions as in the case of OOP) > > That's interesting. You don't consider using functions and procedures > (possibly higher-order ones) to be a way to build abstractions? No, they do not introduce new types and do not form some structure of their values. And "using" is not an abstraction anyway. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes: > On 2023-09-04 18:01, Ben Bacarisse wrote: >> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes: >> >>> On 2023-09-04 13:06, Niklas Holsti wrote: >>>> On 2023-09-04 12:19, CSYH (QAQ) wrote: >>>>> I am new to Ada, I know is there a good way to start this program? >>>>> thanks >>>>> https://projecteuler.net/problem=26 >>>> First invent/discover the method (algorithm) for solving the problem, >>>> without thinking about the programming language. >>>> I don't think any language has built-in features that would lead to a >>>> direct solution, although some functional language with lazy evaluation >>>> could come close, because such languages can manipulate unbounded >>>> (potentially infinite) sequences of values. Such sequences can be handled >>>> in Ada, too, but with more effort -- they are not "built in" to Ada. >>> >>> Infinite division does not require big numbers, which Ada 22 has, but I >>> wound not use them anyway because the performance would be abysmal. >>> >>> BTW, Ada is perfect for numeric algorithms no need to resort to functional >>> mess... (:-)) >> Perfect? That's a bold claim! > > Ada is a very improved descendant of Algol 60, which was designed to codify > algorithms. Yes, though I was respond to you narrower remark about being perfect for numeric algorithms. Are you expending that to perfect for every kind of algorithm? >> Mind you, I don't think this problem is really a numerical one in that >> sense. It needs some simple integer arithmetic but then every language >> is perfect for that sort of arithmetic. > > That is still all about algorithms Yes but, again, that's not what I was responding to. > (rather than about for example building > abstractions as in the case of OOP) That's interesting. You don't consider using functions and procedures (possibly higher-order ones) to be a way to build abstractions? >> Using a functional mess (Haskell) a simple, native solution (i.e. using >> no modules) is only 9 lines long. > > Apart from the fundamental inconsistency of functional paradigm: computing > is about transition of states and nothing else; the imperative languages > express solutions, i.e. an algorithm. Functional, and in general, > declarative languages express puzzles. Rather than try to unpick that paragraph I'll just say that they can, none the less, give simple solutions to this sort of programming problem. -- Ben.
On 2023-09-04 18:01, Ben Bacarisse wrote: > "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes: > >> On 2023-09-04 13:06, Niklas Holsti wrote: >>> On 2023-09-04 12:19, CSYH (QAQ) wrote: >>>> I am new to Ada, I know is there a good way to start this program? >>>> thanks >>>> https://projecteuler.net/problem=26 >>> First invent/discover the method (algorithm) for solving the problem, >>> without thinking about the programming language. >>> I don't think any language has built-in features that would lead to a >>> direct solution, although some functional language with lazy evaluation >>> could come close, because such languages can manipulate unbounded >>> (potentially infinite) sequences of values. Such sequences can be handled >>> in Ada, too, but with more effort -- they are not "built in" to Ada. >> >> Infinite division does not require big numbers, which Ada 22 has, but I >> wound not use them anyway because the performance would be abysmal. >> >> BTW, Ada is perfect for numeric algorithms no need to resort to functional >> mess... (:-)) > > Perfect? That's a bold claim! Ada is a very improved descendant of Algol 60, which was designed to codify algorithms. > Mind you, I don't think this problem is really a numerical one in that > sense. It needs some simple integer arithmetic but then every language > is perfect for that sort of arithmetic. That is still all about algorithms (rather than about for example building abstractions as in the case of OOP) > Using a functional mess (Haskell) a simple, native solution (i.e. using > no modules) is only 9 lines long. Apart from the fundamental inconsistency of functional paradigm: computing is about transition of states and nothing else; the imperative languages express solutions, i.e. an algorithm. Functional, and in general, declarative languages express puzzles. They remind me a math examination tasks on studying a function. Here is a definition. Go figure out the properties and behavior... Or, if you want, functional is like a chess composition: white to move and checkmate in 4 moves. Challenging, but Ada is about playing chess. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes:
> On 2023-09-04 13:06, Niklas Holsti wrote:
>> On 2023-09-04 12:19, CSYH (QAQ) wrote:
>>> I am new to Ada, I know is there a good way to start this program?
>>> thanks
>>> https://projecteuler.net/problem=26
>> First invent/discover the method (algorithm) for solving the problem,
>> without thinking about the programming language.
>> I don't think any language has built-in features that would lead to a
>> direct solution, although some functional language with lazy evaluation
>> could come close, because such languages can manipulate unbounded
>> (potentially infinite) sequences of values. Such sequences can be handled
>> in Ada, too, but with more effort -- they are not "built in" to Ada.
>
> Infinite division does not require big numbers, which Ada 22 has, but I
> wound not use them anyway because the performance would be abysmal.
>
> BTW, Ada is perfect for numeric algorithms no need to resort to functional
> mess... (:-))
Perfect? That's a bold claim!
Mind you, I don't think this problem is really a numerical one in that
sense. It needs some simple integer arithmetic but then every language
is perfect for that sort of arithmetic.
Using a functional mess (Haskell) a simple, native solution (i.e. using
no modules) is only 9 lines long.
I don't want to start a language war. Ada is just more 'wordy' by
deliberate design so a simple Ada solution is inevitably going to be
longer in terms of lines. Rather my purpose in posting is to steer the
OP away from thinking of this as a numerical problem in the classical
sense. It really isn't.
--
Ben.
On 2023-09-04 11:19, CSYH (QAQ) wrote: > I am new to Ada, I know is there a good way to start this program? > thanks > https://projecteuler.net/problem=26 Ok, I leave it to you checking if my implementation is correct. -------------------test.adb---------- with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with Ada.Text_IO; use Ada.Text_IO; procedure Test is N : constant := 1000; function Period (Divisor : Positive) return String is type Remainder is record Index : Positive; Value : Positive; end record; Result : String (1..N); Value : Integer := 1; Remainders : array (1..N) of Remainder; begin for Index in Result'Range loop Value := Value * 10; Result (Index) := Character'Val (Character'Pos ('0') + Value / Divisor); Value := Value mod Divisor; if Value = 0 then return ""; -- Non-periodic end if; if Index > 1 then for Item in 1..Index - 1 loop declare This : Remainder renames Remainders (Item); begin if Value = This.Value then return Result (This.Index + 1..Index); end if; end; end loop; end if; Remainders (Index) := (Index, Value); end loop; raise Constraint_Error with "Period calculation error"; end Period; Max_Period : Unbounded_String; Max_Divisor : Positive; begin for Divisor in 2..999 loop declare This : constant String := Period (Divisor); begin if This /= "" then Put_Line ( "1 /" & Integer'Image (Divisor) & " has " & This & " in period" ); end if; if Length (Max_Period) < This'Length then Max_Period := To_Unbounded_String (This); Max_Divisor := Divisor; end if; end; end loop; Put_Line ( "The first longest period is " & To_String (Max_Period) & " in 1 /" & Integer'Image (Max_Divisor) ); end Test; -------------------test.adb---------- It gives the longest period for 1/983. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
On 2023-09-04 13:06, Niklas Holsti wrote: > On 2023-09-04 12:19, CSYH (QAQ) wrote: >> I am new to Ada, I know is there a good way to start this program? >> thanks >> https://projecteuler.net/problem=26 > > First invent/discover the method (algorithm) for solving the problem, > without thinking about the programming language. > > I don't think any language has built-in features that would lead to a > direct solution, although some functional language with lazy evaluation > could come close, because such languages can manipulate unbounded > (potentially infinite) sequences of values. Such sequences can be > handled in Ada, too, but with more effort -- they are not "built in" to > Ada. Infinite division does not require big numbers, which Ada 22 has, but I wound not use them anyway because the performance would be abysmal. BTW, Ada is perfect for numeric algorithms no need to resort to functional mess... (:-)) The problem itself requires as you said mathematical analysis, because a naive method of comparing partial division result with itself is obviously wrong. E.g. let you have 0.12341234... you could not conclude that the period is (1234) because it could actually be (123412345). -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
On 2023-09-04 12:19, CSYH (QAQ) wrote:
> I am new to Ada, I know is there a good way to start this program?
> thanks
> https://projecteuler.net/problem=26
First invent/discover the method (algorithm) for solving the problem,
without thinking about the programming language.
I don't think any language has built-in features that would lead to a
direct solution, although some functional language with lazy evaluation
could come close, because such languages can manipulate unbounded
(potentially infinite) sequences of values. Such sequences can be
handled in Ada, too, but with more effort -- they are not "built in" to Ada.
I am new to Ada, I know is there a good way to start this program? thanks https://projecteuler.net/problem=26
Simon Wright <simon@pushface.org> writes:
> richardthiebaud <thiebauddick2@aol.com> writes:
>
>> Under gtkada, must procedures that handle events always be in their
>> own package?
>
> In general, they'd need to be in _a_ package. You could group related
> event handlers in a package.
I mean, if you had handlers for button A press & button A release they
could be grouped in one package. Int might make more sense for button B
event handlers to be grouped in another package. All depends on the
application
On 03/09/2023 15:06, Simon Wright wrote:
> richardthiebaud <thiebauddick2@aol.com> writes:
>
>> Under gtkada, must procedures that handle events always be in their
>> own package?
>
> In general, they'd need to be in _a_ package. You could group related
> event handlers in a package.
It's because what is beteen this:
procedure test1 is
and
begin -- test1
is on the stack and therefore not in permanent memory.
richardthiebaud <thiebauddick2@aol.com> writes:
> Under gtkada, must procedures that handle events always be in their
> own package?
In general, they'd need to be in _a_ package. You could group related
event handlers in a package.
Below is a simple example of the Api usage -------------------------------------------------------------------------------- with Ada.Wide_Text_IO; with Ada.Strings.Wide_Unbounded; with WinRt; with WinRt.Windows.Foundation; with WinRt.Windows.Networking; with WinRt.Windows.Networking.Sockets; with WinRt.Windows.Storage.Streams; with WinRt.Windows.Web.Http; -------------------------------------------------------------------------------- procedure WinRt3Test2 is use WinRt; use Ada.Strings.Wide_Unbounded; Hr : HResult := 0; function "+"(value : Wide_String) return Unbounded_Wide_String renames To_Unbounded_Wide_String; function "+"(value : Unbounded_Wide_String) return Wide_String renames To_Wide_String; begin Hr := RoInitialize; if Hr = 0 then declare Uri : Windows.Foundation.Uri := Windows.Foundation.Constructor (+"http://www.google.com"); HttpClient : Windows.Web.Http.HttpClient := Windows.Web.Http.Constructor; Result : WString; begin Result := HttpClient.GetStringAsync (Uri); Ada.Wide_Text_IO.Put_Line (+Result); HttpClient.Close; end; declare Host : Windows.Networking.HostName := Windows.Networking.Constructor(+"www.google.com"); Port : WString := +"80"; Socket : Windows.Networking.Sockets.StreamSocket := Windows.Networking.Sockets.Constructor; DataWriter : Windows.Storage.Streams.DataWriter := Windows.Storage.Streams.Constructor (Socket.get_OutputStream); begin Socket.ConnectAsync (Host, Port); Socket.Close; end; RoUninitialize; end if; end;
On 9/1/23 17:44, Luke A. Guest wrote: > On 01/09/2023 22:41, Luke A. Guest wrote: >> Handler needs to be in a package you with. >> > >>> begin -- Gtk.Init; ....; >>> >>> test1.adb:32:17: subprogram must not be deeper than access type > > Ada doesn't like 'access types to be in an area that can go out of scope > iirc. You can get around it with unchecked_access, but if you put > handler into a package of it's own, it's at library level and is > available to grab the access of. > That worked, thanks. Under gtkada, must procedures that handle events always be in their own package?
On 01/09/2023 22:41, Luke A. Guest wrote: > Handler needs to be in a package you with. > >> begin -- Gtk.Init; >> Gtk.Main.Init; >> Gtk.Window.Gtk_New (Window => Win, The_Type => >> Gtk.Enums.Window_Toplevel); >> Win.Set_Position (Win_Pos_Center); >> Gtk.Window.Set_Title (Window => Win, Title => "Editor"); >> Gtk.Window.Show_All (Win); >> Win.On_Button_Press_Event <------------ line that gets the error >> (Call => Handler'Access, >> After => False, >> Slot => Win); >> Gtk.Main.Main; >> end test1; >> >> I get the compiler error message: >> >> test1.adb:32:17: subprogram must not be deeper than access type Ada doesn't like 'access types to be in an area that can go out of scope iirc. You can get around it with unchecked_access, but if you put handler into a package of it's own, it's at library level and is available to grab the access of.
Handler needs to be in a package you with.
On 01/09/2023 22:04, richardthiebaud wrote:
> in the following program:
>
> with Gtk.Enums; use Gtk.Enums;
> with Gtk.Main;
> with Gtk.Window;
> with Gdk;
> with Gdk.Event;
> with Glib;
> with Glib.Object;
>
> procedure test1 is
> Win : Gtk.Window.Gtk_Window;
> function Handler
> (Self : access Glib.Object.GObject_Record'Class;
> Event : Gdk.Event.Gdk_Event_Button) return Boolean is
> begin
> Gtk.Main.Main_Quit;
> return True;
> end Handler;
> --
> -- defined in gtk-widget.ads
> --
> -- type Cb_GObject_Gdk_Event_Button_Boolean is not null access
> function
> -- (Self : access Glib.Object.GObject_Record'Class;
> -- Event : Gdk.Event.Gdk_Event_Button) return Boolean;
>
> begin -- Gtk.Init;
> Gtk.Main.Init;
> Gtk.Window.Gtk_New (Window => Win, The_Type =>
> Gtk.Enums.Window_Toplevel);
> Win.Set_Position (Win_Pos_Center);
> Gtk.Window.Set_Title (Window => Win, Title => "Editor");
> Gtk.Window.Show_All (Win);
> Win.On_Button_Press_Event <------------ line that gets the error
> (Call => Handler'Access,
> After => False,
> Slot => Win);
> Gtk.Main.Main;
> end test1;
>
> I get the compiler error message:
>
> test1.adb:32:17: subprogram must not be deeper than access type
>
> What does this mean and how can I correct it?
in the following program: with Gtk.Enums; use Gtk.Enums; with Gtk.Main; with Gtk.Window; with Gdk; with Gdk.Event; with Glib; with Glib.Object; procedure test1 is Win : Gtk.Window.Gtk_Window; function Handler (Self : access Glib.Object.GObject_Record'Class; Event : Gdk.Event.Gdk_Event_Button) return Boolean is begin Gtk.Main.Main_Quit; return True; end Handler; -- -- defined in gtk-widget.ads -- -- type Cb_GObject_Gdk_Event_Button_Boolean is not null access function -- (Self : access Glib.Object.GObject_Record'Class; -- Event : Gdk.Event.Gdk_Event_Button) return Boolean; begin -- Gtk.Init; Gtk.Main.Init; Gtk.Window.Gtk_New (Window => Win, The_Type => Gtk.Enums.Window_Toplevel); Win.Set_Position (Win_Pos_Center); Gtk.Window.Set_Title (Window => Win, Title => "Editor"); Gtk.Window.Show_All (Win); Win.On_Button_Press_Event <------------ line that gets the error (Call => Handler'Access, After => False, Slot => Win); Gtk.Main.Main; end test1; I get the compiler error message: test1.adb:32:17: subprogram must not be deeper than access type What does this mean and how can I correct it?
Fascinating (C) Spock.
Big up for this work !
Le 30/08/2023 à 15:48, Luke A. Guest a écrit :
> Edward Fish has managed to get the DTIC to scan in the other language's
> reports.
>
> This has been a combined effort between a few of us on IRC to try to get
> the other two languages, blue and yellow released so we can see what
> could've happened.
>
> This report contains all 4 language reports.
>
> https://apps.dtic.mil/sti/trecms/pdf/ADB950587.pdf
--
Stéphane Rivière
Ile d'Oléron - France
On 30/08/2023 21:45, moi wrote:
> The effort is much appreciated, but that PDF is over 320MB!
> It does not make for easy reading.
> Could the four colour books not be put in separate files?
I've mentioned doing that on irc.
On 30/08/2023 14:48, Luke A. Guest wrote:
> Edward Fish has managed to get the DTIC to scan in the other language's
> reports.
>
> This has been a combined effort between a few of us on IRC to try to get
> the other two languages, blue and yellow released so we can see what
> could've happened.
>
> This report contains all 4 language reports.
>
> https://apps.dtic.mil/sti/trecms/pdf/ADB950587.pdf
>
The effort is much appreciated, but that PDF is over 320MB!
It does not make for easy reading.
Could the four colour books not be put in separate files?
--
Bill F.
On 30/08/2023 14:48, Luke A. Guest wrote: > This report contains all 4 language reports. > > https://apps.dtic.mil/sti/trecms/pdf/ADB950587.pdf > Now we have all 5 reference docs out in the open, yes 5. I want to ask the people who were there at the time, were there any analyses of the Tartan language? Design: https://apps.dtic.mil/sti/citations/ADA062815
Edward Fish has managed to get the DTIC to scan in the other language's reports. This has been a combined effort between a few of us on IRC to try to get the other two languages, blue and yellow released so we can see what could've happened. This report contains all 4 language reports. https://apps.dtic.mil/sti/trecms/pdf/ADB950587.pdf
Hello, I am having difficulties with a GNAT 5.4.0 FSF toolchain build for an arm cross-compiled target on linux, compiling Ada and C sources. For some reason, gprbuild needs to be run twice. On the first attempt, the build fails because, I think the Ada code is expecting to find the C code, which hasn't been compiled yet. By the time the build execution is complete however, it appears the C code has been compiled. On the second attempt, the gprbuild execution succeeds. Does this ring a bell with anyone, as to what the problem might be?
On 2023-08-28 19:33, G.B. wrote: > On 28.08.23 18:09, Dmitry A. Kazakov wrote: >> On 2023-08-28 17:42, Stephen Davies wrote: >>> On Monday, 28 August 2023 at 11:58:24 UTC+1, Dmitry A. Kazakov wrote: >>>> On 2023-08-28 11:18, Stephen Davies wrote: >>>> This will not happen either. But here I would agree, it is clearly a >>>> case of language littering. >>> >>> Littering, schmittering, how about adding Bin_Image, Oct_Image & >>> Hex_Image >>> for Ints and Dec_Image for Ints & Reals ;-) >> >> Bin_Width_1_Image, Dec_Width_4_Image and so on... Cool, make Ada C >> again! (:-)) > > Or maybe leave type attributes alone. Instead, let Ada.Streams > have I/O manipulating setters. > > Then, in order to preserve the meaning of "corresponding S'Output" > (LRM 13.13.2) for every S'Input, add AI to the Ada run-time system. I like the idea of unification of serialization and formatting. However it does not solve the problem of parameters. In GUI frameworks facing this very problem the parameters for rendering are set into the graphic context/surface. E.g. in the case of string formatting you would need a global object to set the parameters into. E.g. a set of procedures like Ada.Text_IO.Set_Field_Width, Ada.Text_IO.Set_Integer_Base etc. That would be incredibly boring and unsafe. For stream serialization the parameters could be set on the stream itself. Which might break a lot of code if you added them to Root_Stream_Type. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
On 2023-08-28 19:58, Niklas Holsti wrote: > On 2023-08-28 13:58, Dmitry A. Kazakov wrote: >> On 2023-08-28 11:18, Stephen Davies wrote: >> >>> I did read Randy's response, he explained the difficulty in adding >>> parameters to 'Image, >> >> He rather explained that this will never happen... (:-)) >> >> There is no good reason why attributes should not have the same >> parameter syntax as subprograms and entry calls. > > Yes in principle, but it is understandble that making this happen now > could impact both the language definition and various implementations in > non-trivial ways. Comparing to the useless and damaging sediments the language collects with each new release? (:-)) >> Neither there is one why 'Image must be a non-overridable attribute > > In Ada 2022, 'Image is defined to call the new attribute 'Put_Image, > which can be specified (ie. overridden) by the programmer for any type. > > See http://www.ada-auth.org/standards/22rm/html/RM-4-10.html. Ah, thanks. I vaguely remembered that there was a yet another ugly hack that does not really solves anything significant, but could not find it. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
On 2023-08-28 13:58, Dmitry A. Kazakov wrote: > On 2023-08-28 11:18, Stephen Davies wrote: > >> I did read Randy's response, he explained the difficulty in adding >> parameters to 'Image, > > He rather explained that this will never happen... (:-)) > > There is no good reason why attributes should not have the same > parameter syntax as subprograms and entry calls. Yes in principle, but it is understandble that making this happen now could impact both the language definition and various implementations in non-trivial ways. > Neither there is one > why 'Image must be a non-overridable attribute In Ada 2022, 'Image is defined to call the new attribute 'Put_Image, which can be specified (ie. overridden) by the programmer for any type. See http://www.ada-auth.org/standards/22rm/html/RM-4-10.html.
On 28.08.23 18:09, Dmitry A. Kazakov wrote:
> On 2023-08-28 17:42, Stephen Davies wrote:
>> On Monday, 28 August 2023 at 11:58:24 UTC+1, Dmitry A. Kazakov wrote:
>>> On 2023-08-28 11:18, Stephen Davies wrote:
>>> This will not happen either. But here I would agree, it is clearly a
>>> case of language littering.
>>
>> Littering, schmittering, how about adding Bin_Image, Oct_Image & Hex_Image
>> for Ints and Dec_Image for Ints & Reals ;-)
>
> Bin_Width_1_Image, Dec_Width_4_Image and so on... Cool, make Ada C again! (:-))
Or maybe leave type attributes alone. Instead, let Ada.Streams
have I/O manipulating setters.
Then, in order to preserve the meaning of "corresponding S'Output"
(LRM 13.13.2) for every S'Input, add AI to the Ada run-time system.
On 2023-08-28 17:42, Stephen Davies wrote: > On Monday, 28 August 2023 at 11:58:24 UTC+1, Dmitry A. Kazakov wrote: >> On 2023-08-28 11:18, Stephen Davies wrote: >> This will not happen either. But here I would agree, it is clearly a >> case of language littering. > > Littering, schmittering, how about adding Bin_Image, Oct_Image & Hex_Image > for Ints and Dec_Image for Ints & Reals ;-) Bin_Width_1_Image, Dec_Width_4_Image and so on... Cool, make Ada C again! (:-)) >> However see the GNAT-specific 'Img attribute. For debugging purposes it >> does not add space where 'Image also for debugging purposes adds! (:-)) > > Unless this changed recently, 'Img also adds a leading space. I see, the same mess then... -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
On Monday, 28 August 2023 at 11:58:24 UTC+1, Dmitry A. Kazakov wrote: > On 2023-08-28 11:18, Stephen Davies wrote: > This will not happen either. But here I would agree, it is clearly a > case of language littering. Littering, schmittering, how about adding Bin_Image, Oct_Image & Hex_Image for Ints and Dec_Image for Ints & Reals ;-) > However see the GNAT-specific 'Img attribute. For debugging purposes it > does not add space where 'Image also for debugging purposes adds! (:-)) Unless this changed recently, 'Img also adds a leading space.
On 2023-08-28 11:18, Stephen Davies wrote: > I did read Randy's response, he explained the difficulty in adding > parameters to 'Image, He rather explained that this will never happen... (:-)) There is no good reason why attributes should not have the same parameter syntax as subprograms and entry calls. Neither there is one why 'Image must be a non-overridable attribute or why different classes of types must have same parameter lists in their 'Image. > so I suggested an alternative parameter-less > attribute. You could allow the output of this attribute to be > configurable by either some package data (c.f. Text_IO.Default_Width) > and/or by the OS. To be honest, all I really want is an attribute that > any Ada program can use to get a string suitable for output to its > users, i.e no leading space and exponentiation only used when needed. This will not happen either. But here I would agree, it is clearly a case of language littering. However see the GNAT-specific 'Img attribute. For debugging purposes it does not add space where 'Image also for debugging purposes adds! (:-)) As Chairman Mao used to say: "In a word, while the prospects are bright, the road has twists and turns." (:-)) -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
On Friday, 25 August 2023 at 14:02:57 UTC+1, Dmitry A. Kazakov wrote:
> On 2023-08-25 11:04, Stephen Davies wrote:
> The proposal was to add parameters defaulted to the existing behavior.
> Year'Image (Plus=>None,Width=>4,Alignment=>Right,Padding=>'0')
>
> > So the programmer could use 'User_Image to generate a display string
> > that will be formatted to the users preferences without knowing
> > (or being able to make assumptions about) those preferences,
> > e.g. Put_Line ("The result is " & Result'User_Image)
> This will be rejected on the same grounds as the original proposal.
> Read Randy's response.
I did read Randy's response, he explained the difficulty in adding
parameters to 'Image, so I suggested an alternative parameter-less
attribute. You could allow the output of this attribute to be
configurable by either some package data (c.f. Text_IO.Default_Width)
and/or by the OS. To be honest, all I really want is an attribute that
any Ada program can use to get a string suitable for output to its
users, i.e no leading space and exponentiation only used when needed.
Dear Ada community I have created a new git repo for the Ada binding to WinRT (now version 3) This version is a cleaner implementation than the previous version and includes the following changes 1) Wide strings are mapped to HStrings 2) Async operations and actions are handled automatically 3) code files now contain code at the Namespace level Git repo is located here https://github.com/Alex-Gamper/Ada-WinRt3
Unfortunately they don't have any documentation as it was setup very long ago.
If I had it on my home PC I would have more time to look at it.
Chris
On Thursday, August 24, 2023 at 7:13:57 PM UTC-7, Ludovic Brenta wrote:
> If your customer has UNAS, they probably have documentation, or what
> passes as documentation.
>
> BTW, UNAS is a framework for distributed applications i.e. multiple
> programs doing remote procedure calls and message passing over the
> network.
>
> --
> Ludovic Brenta.
On 2023-08-25 11:04, Stephen Davies wrote: > On Friday, 25 August 2023 at 08:26:08 UTC+1, Dmitry A. Kazakov wrote: >> On 2023-08-24 21:59, Stephen Davies wrote: >>> How about an attribute called something like User_Image >>> where programmers should make no assumption about the >>> generated strings and implementations can provide >>> OS-specific ways to customise things like leading >>> space/plus/neither, decimal separator character, digit >>> grouping character/spacing, exponential notation, enum >>> casing, etc. >> How anything can be implemented without making assumptions = specifications? > The reason that the existing 'Image cannot be changed is that it would > break existing software that replies upon knowledge about the generated > string, e.g. Integer'Image(Year)(2..5). The proposal was to add parameters defaulted to the existing behavior. Year'Image (Plus=>None,Width=>4,Alignment=>Right,Padding=>'0') > So the programmer could use 'User_Image to generate a display string > that will be formatted to the users preferences without knowing > (or being able to make assumptions about) those preferences, > e.g. Put_Line ("The result is " & Result'User_Image) This will be rejected on the same grounds as the original proposal. Read Randy's response. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
On Friday, 25 August 2023 at 08:26:08 UTC+1, Dmitry A. Kazakov wrote:
> On 2023-08-24 21:59, Stephen Davies wrote:
> > How about an attribute called something like User_Image
> > where programmers should make no assumption about the
> > generated strings and implementations can provide
> > OS-specific ways to customise things like leading
> > space/plus/neither, decimal separator character, digit
> > grouping character/spacing, exponential notation, enum
> > casing, etc.
> How anything can be implemented without making assumptions = specifications?
The reason that the existing 'Image cannot be changed is that it would
break existing software that replies upon knowledge about the generated
string, e.g. Integer'Image(Year)(2..5).
So the programmer could use 'User_Image to generate a display string
that will be formatted to the users preferences without knowing
(or being able to make assumptions about) those preferences,
e.g. Put_Line ("The result is " & Result'User_Image)
On 2023-08-24 21:59, Stephen Davies wrote: > On Wednesday, 23 August 2023 at 17:16:12 UTC+1, Dmitry A. Kazakov wrote: >> On 2023-08-23 12:20, Stephen Davies wrote: >> >>> Actually, I think it might also be nice if Float'Trim_Image(X) returned >>> a string that only used exponential notation for very large or very >>> small values (which seems to be the default behaviour in Python). >> To use the shortest representation for the given precision unless >> specified otherwise: >> >> http://www.dmitry-kazakov.de/ada/strings_edit.htm#6 >> >> Ada 'Image attributes have "typographic quality" in plain contradiction >> to the claim being for debugging purpose. That is why the plus sign is >> always represented by a space and why floating-point representation is >> always selected even for exact zero and the way the exponent part is >> formatted. The typographic idea is to have *same looking* output. Note, >> even if the output is mathematically incorrect as in the case of >> floating-point numbers. 'Image considers precision and accuracy same, >> which is *always* wrong when dealing with floating-point numbers. >>> Different names would then be needed (Tidy_Image and Tidy_Width?). >> It takes several parameters to control the behavior in a reasonable way. >> -- > How about an attribute called something like User_Image > where programmers should make no assumption about the > generated strings and implementations can provide > OS-specific ways to customise things like leading > space/plus/neither, decimal separator character, digit > grouping character/spacing, exponential notation, enum > casing, etc. How anything can be implemented without making assumptions = specifications? -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
Chris Sparks <mrada442@gmail.com> writes:
> I suspected as much. If I could only find something that would show
> me how to install it and operational so I can finish my upgrade
> project. Going to a new software is something that would bring on
> risk, unless I could narrow down what exactly the UNAS is being used
> for. This effort I am working on is for the contract I am working on.
>
> What would really help is documentation. Installation, operation so
> that I can tell that it is working.
If your customer has UNAS, they probably have documentation, or what
passes as documentation.
BTW, UNAS is a framework for distributed applications i.e. multiple
programs doing remote procedure calls and message passing over the
network.
--
Ludovic Brenta.
I suspected as much. If I could only find something that would show me how to install it and operational so I can finish my upgrade project. Going to a new software is something that would bring on risk, unless I could narrow down what exactly the UNAS is being used for. This effort I am working on is for the contract I am working on. What would really help is documentation. Installation, operation so that I can tell that it is working. Chris...
Chris Sparks <mrada442@gmail.com> writes: > Does know how to get the complete UNAS package from TRW? I use it at > work and I see it has an open usage clause in the source headers. > Since I am not allowed to download it from my work, maybe I can find a > source elsewhere to get it? Doubtful. > Also are there any tutorials out there on how to use it? "Out there", definitely not. In a few closed places that still use UNAS, perhaps but doubtful. In the one place that I know still uses UNAS, no. > I am in the process of upgrading the Ada (83 to 05) in my current > project and I am getting stuck on the plethora of call being made by > UNAS for which I don't even know how to set it up so it can run > happily. Do I divine correctly that "your current project" is not "at work"? If so I would suggest you consider polyorb as a replacement(*). UNAS is long dead, unmaintained and unmaintainable, mostly because it is proprietary software witout anyone getting a license for it other than in their current application. Also, apart from a couple of people I know, nobody understands UNAS anymore. The company that made it has abandoned it, perhaps even gone bankrupt, so UNAS is mostly technical debt. Sorry for the bad "news". (*) Modern multi-core computers with lots of memory might even make it feasible to avoid distributing the software over multiple computers in the first place. Maybe a monolithic application would do the job just fine, nowadays. -- Ludovic Brenta. Actually, the customers cautiously pre-prepare marketplace corporate values.
On Wednesday, 23 August 2023 at 17:16:12 UTC+1, Dmitry A. Kazakov wrote:
> On 2023-08-23 12:20, Stephen Davies wrote:
>
> > Actually, I think it might also be nice if Float'Trim_Image(X) returned
> > a string that only used exponential notation for very large or very
> > small values (which seems to be the default behaviour in Python).
> To use the shortest representation for the given precision unless
> specified otherwise:
>
> http://www.dmitry-kazakov.de/ada/strings_edit.htm#6
>
> Ada 'Image attributes have "typographic quality" in plain contradiction
> to the claim being for debugging purpose. That is why the plus sign is
> always represented by a space and why floating-point representation is
> always selected even for exact zero and the way the exponent part is
> formatted. The typographic idea is to have *same looking* output. Note,
> even if the output is mathematically incorrect as in the case of
> floating-point numbers. 'Image considers precision and accuracy same,
> which is *always* wrong when dealing with floating-point numbers.
> > Different names would then be needed (Tidy_Image and Tidy_Width?).
> It takes several parameters to control the behavior in a reasonable way.
> --
How about an attribute called something like User_Image
where programmers should make no assumption about the
generated strings and implementations can provide
OS-specific ways to customise things like leading
space/plus/neither, decimal separator character, digit
grouping character/spacing, exponential notation, enum
casing, etc.
On 2023-08-23 12:20, Stephen Davies wrote: > Actually, I think it might also be nice if Float'Trim_Image(X) returned > a string that only used exponential notation for very large or very > small values (which seems to be the default behaviour in Python). To use the shortest representation for the given precision unless specified otherwise: http://www.dmitry-kazakov.de/ada/strings_edit.htm#6 Ada 'Image attributes have "typographic quality" in plain contradiction to the claim being for debugging purpose. That is why the plus sign is always represented by a space and why floating-point representation is always selected even for exact zero and the way the exponent part is formatted. The typographic idea is to have *same looking* output. Note, even if the output is mathematically incorrect as in the case of floating-point numbers. 'Image considers precision and accuracy same, which is *always* wrong when dealing with floating-point numbers. > Different names would then be needed (Tidy_Image and Tidy_Width?). It takes several parameters to control the behavior in a reasonable way. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
On Tuesday, 22 August 2023 at 09:13:50 UTC+1, Dmitry A. Kazakov wrote:
> Nobody loves the syntax T'Image (X) or X'Image! Give programmers X.Image
> and [<path-of-package-names-nobody-remembers>].Image (X) and they will
> forget about the attribute.
I have no issue with the 'Image syntax.
Perhaps the formatting parameters could be restricted to T'Image(X) and
not available for X'Image? Or, maybe the language should just add
'Trim_Image and 'Trim_Width and leave the advanced formatting to a
library.
Actually, I think it might also be nice if Float'Trim_Image(X) returned
a string that only used exponential notation for very large or very
small values (which seems to be the default behaviour in Python).
Different names would then be needed (Tidy_Image and Tidy_Width?).
Does know how to get the complete UNAS package from TRW? I use it at work and I see it has an open usage clause in the source headers. Since I am not allowed to download it from my work, maybe I can find a source elsewhere to get it? Also are there any tutorials out there on how to use it? I am in the process of upgrading the Ada (83 to 05) in my current project and I am getting stuck on the plethora of call being made by UNAS for which I don't even know how to set it up so it can run happily. Chris Sparks
On 2023-08-22 01:34, Randy Brukardt wrote: > "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message > news:ubsn75$1a024$2@dont-email.me... >> On 2023-08-20 09:25, Randy Brukardt wrote: >> >>> Additionally, one ends up with a magic mechanism that only the compiler >>> can >>> use. That *never* is a good idea. >> >> A better idea would be to improve the language to remove need in magic, >> but that is *never* a good idea either! (:-)) > > No, I generally agree with this. We probably disagree on what would > consistute an improvement, however. ;-) To the same effect... >>> Attributes do not allow named parameters outside a few special cases, and >>> *never* allow reordering of parameters. Does that need to change, too? >> >> Elementary! Attribute is just an alternative syntactic form of a >> subroutine call. There is no reason why attribute should be limited to >> look like FORTRAN IV! (:-)) > > That turns out to be a bad idea. The reason people love attributes so is > that they don't have to worry about visibility -- they're always visible. > That is not and cannot be true for subprograms. > > For example, the reason that we don't allow user-defined attributes is that > they would compromise portability. Since they're always visible, they could > hide/make illegal attributes that are used in units (like generic units) > that don't know anything about the additions. In other words attribute is a primitive subprogram, yes. > Moreover, not all attributes > can be described as subprograms given Ada's current rules (reduction > attributes have a type parameter; some of the annex 13 attributes have "any > type" parameters, etc.) It is a primitive subprogram of some built-in class. The magic is not in the attribute, it is the class description. For magical classes overriding a primitive operation could look like for <member-type>'<primitive-operation-name> use <subroutine-name>; > It certainly would be a very bad thing for Janus/Ada, which would have to > have its resolution and subprogram definition mechanisms redesigned. (All > subprograms are materialized in the Janus/Ada symboltable, in particular for > visibility management reasons, and that would not be possible for > attributes. Resolution only works on materialized subprogram definitions.) Only if you wanted to remove all magic, which is never be possible. But you can do some. >>> 'Image is convinient for integer and enumeration output, and one can >>> format >>> them in the rare case where that is necessary. But it is useless for >>> float >>> output -- manual reformatting the output of 'Image would round the >>> results >>> incorrectly. >> >> Which is why Float 'Image must have parameters! > > Which is why one shouldn't use Float'Image! ;-) Any application programmer will tell you that all types must have 'Image! (:-)) >>> Ada has few built-in facilities because it's primary purpose is to >>> support >>> the development of proper ADTs. Ease of writing is not a goal at all, and >>> in >>> most cases, the extra text is valuable to compilers and tools (even if it >>> is >>> not so valuable to human readers). >> >> How is this related to attribute 'Image lacking necessary parameters? Why >> generic function having such parameters is OK, while 'Image with same >> parameters is not? > > It's perfectly OK to overload functions however one wants, because you can > keep anything that is problem from being considered by avoiding "use" (and > "with"). > > 'Image is not appropriate for an attribute in the first place; attributes > are supposed to be simple compile-time defined properties of a type. String > conversion is not that. But stream serialization is? The problem is that whatever intention Ada designers had for attributes they also gave them property of being a primitive operation where no user-defined class allowed. This power steamrolls any "good" intentions. Nobody loves the syntax T'Image (X) or X'Image! Give programmers X.Image and [<path-of-package-names-nobody-remembers>].Image (X) and they will forget about the attribute. > My preference for making Ada easier to use for this sort of thing is allow > class-wide elementary types. Then one could have non-generic subnprograms > that operation on all integer and float types. Yes. > (Fixed and enumerations would > still require generics, although I suspect most people would simply convert > fixed to float for output rather than worrying about an instantiation.) It would be interesting to play with the ways of constructing enumeration and fixed point classes. Both have static parameters, e.g. list of names in the case of enumeration. There might be a way achieve static polyphormism without going full generic but also without turning the language into a C++ templates mess! > That > would make a library simple to use, and few people would think that > something builr-in is needed. Absolutely. Ideally, everything must go into libraries. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
On 2023-08-22 01:37, Randy Brukardt wrote: > "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message > news:ubsmak$1a024$1@dont-email.me... > ... >> Of course it must be generic, which kills all fun. > > As noted in my other message, resurrecting the Ada 95 idea allowing > class-wide types for elementary types would eliminate (or at least greatly > reduce) this problem. Yes, but that would be a huge change. > I think that would be a more productive way to address > this problem than hacking around with 'Image some more. (We've already > proven that it is not a good way to define anything user-defined, thus the > rather complex way to define such 'Image attributes.) One does not exclude another. If you allowed classes then there would be no reason not to have attributes official primitive operations. E.g. an "imaginable" interface would provide "'Image" and the standard Integer would inherit to "imaginable"... -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message
news:ubsmak$1a024$1@dont-email.me...
...
> Of course it must be generic, which kills all fun.
As noted in my other message, resurrecting the Ada 95 idea allowing
class-wide types for elementary types would eliminate (or at least greatly
reduce) this problem. I think that would be a more productive way to address
this problem than hacking around with 'Image some more. (We've already
proven that it is not a good way to define anything user-defined, thus the
rather complex way to define such 'Image attributes.)
Randy.
"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message news:ubsn75$1a024$2@dont-email.me... > On 2023-08-20 09:25, Randy Brukardt wrote: > >> Additionally, one ends up with a magic mechanism that only the compiler >> can >> use. That *never* is a good idea. > > A better idea would be to improve the language to remove need in magic, > but that is *never* a good idea either! (:-)) No, I generally agree with this. We probably disagree on what would consistute an improvement, however. ;-) >> Attributes do not allow named parameters outside a few special cases, and >> *never* allow reordering of parameters. Does that need to change, too? > > Elementary! Attribute is just an alternative syntactic form of a > subroutine call. There is no reason why attribute should be limited to > look like FORTRAN IV! (:-)) That turns out to be a bad idea. The reason people love attributes so is that they don't have to worry about visibility -- they're always visible. That is not and cannot be true for subprograms. For example, the reason that we don't allow user-defined attributes is that they would compromise portability. Since they're always visible, they could hide/make illegal attributes that are used in units (like generic units) that don't know anything about the additions. Moreover, not all attributes can be described as subprograms given Ada's current rules (reduction attributes have a type parameter; some of the annex 13 attributes have "any type" parameters, etc.) It certainly would be a very bad thing for Janus/Ada, which would have to have its resolution and subprogram definition mechanisms redesigned. (All subprograms are materialized in the Janus/Ada symboltable, in particular for visibility management reasons, and that would not be possible for attributes. Resolution only works on materialized subprogram definitions.) >> 'Image is convinient for integer and enumeration output, and one can >> format >> them in the rare case where that is necessary. But it is useless for >> float >> output -- manual reformatting the output of 'Image would round the >> results >> incorrectly. > > Which is why Float 'Image must have parameters! Which is why one shouldn't use Float'Image! ;-) >> Ada has few built-in facilities because it's primary purpose is to >> support >> the development of proper ADTs. Ease of writing is not a goal at all, and >> in >> most cases, the extra text is valuable to compilers and tools (even if it >> is >> not so valuable to human readers). > > How is this related to attribute 'Image lacking necessary parameters? Why > generic function having such parameters is OK, while 'Image with same > parameters is not? It's perfectly OK to overload functions however one wants, because you can keep anything that is problem from being considered by avoiding "use" (and "with"). 'Image is not appropriate for an attribute in the first place; attributes are supposed to be simple compile-time defined properties of a type. String conversion is not that. My preference for making Ada easier to use for this sort of thing is allow class-wide elementary types. Then one could have non-generic subnprograms that operation on all integer and float types. (Fixed and enumerations would still require generics, although I suspect most people would simply convert fixed to float for output rather than worrying about an instantiation.) That would make a library simple to use, and few people would think that something builr-in is needed. Randy.
Your #3 is the point of course. If a reasonable library can be written, you
should use that. After all, the Ada philosophy is that it is suspicious to
use any built-in types. Why then should it be less suspicious to use other
things that are built-in??
The best approach for Ada going forward is the add things that make it
easier to build good libraries (as in user-defined literals). And minimize
magic.
Randy.
"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message
news:ubsmak$1a024$1@dont-email.me...
> On 2023-08-20 09:53, G.B. wrote:
>
>> Could there be a language defined type F whose purpose is to support
>> the description of formats? Objects of type F would "configure"
>> what 'Image does when computing a representation of a date, a number, ...
>
> Not without multiple dispatch support and classes:
>
> Type x Format [ x Target ]
>
> Otherwise you get an untyped mess as in C:
>
> printf ("%s", 123);
>
> In the case of 'Image the dispatch is hard-wired. The compiler generates
> it according to one of built-in classes like 'integer type'. So yes it
> would be no problem to add parameters specific to each of the classes as
> well as common parameters like padding or alignment inside a field. But it
> will never ever happen.
>
> You seem suggesting a class-wide parameter type instead:
>
> type Format_Type is tagged record
> Width : Natural := 0;
> Alignment : Alignment_Type := Left;
> Padding : Character := ' ';
> end record;
> type Integer_Format is new Format_Type with record
> Plus_Sign : Boolean := False;
> Base : Base_Type := 10;
> end record;
>
> X'Image (Format => Format_Type'Class)
>
> This still requires a change that will be outright rejected on highest
> philosophical grounds. (:-))
>
> However with a Format_Type you do not need 'Image. You can simply use a
> binary operation, e.g.
>
> function "/" (Value : Integer; Format : Integer_Format)
> return String;
>
> So would do
>
> Put_Line ("X=" & X / (Width=>10, Padding=>'0', Alignment=>Right));
>
> instead of
>
> Put_Line ("X=" & X'Image (Width=>10, Padding=>'0', Alignment=>Right));
>
> Of course it must be generic, which kills all fun.
>
> Ergo
>
> 1. Compiler magic is necessary because the language type system is too
> weak to express things like formatting.
>
> 2. No proposal however useful and reasonable will survive ARG because of
> #1.
>
> 3. Use a library that does the stuff. E.g.
>
> http://www.dmitry-kazakov.de/ada/strings_edit.htm#Integer_Edit
>
> --
> Regards,
> Dmitry A. Kazakov
> http://www.dmitry-kazakov.de
>
> On Monday, August 14, 2023 at 2:30:08 PM UTC-6, wrote: > > > > And how does GCC 12 compare with GCC 13 WRT Ada 2022? This post could be helpful: https://forum.ada-lang.io/t/gcc-13-1-released/374/3 In https://learn.adacore.com/courses/whats-new-in-ada-2022/index.html course there are GCC versions per feature. Unfortunately the feature list is not complete. -- Max
On 2023-08-20 09:25, Randy Brukardt wrote: > Additionally, one ends up with a magic mechanism that only the compiler can > use. That *never* is a good idea. A better idea would be to improve the language to remove need in magic, but that is *never* a good idea either! (:-)) > Attributes do not allow named parameters outside a few special cases, and > *never* allow reordering of parameters. Does that need to change, too? Elementary! Attribute is just an alternative syntactic form of a subroutine call. There is no reason why attribute should be limited to look like FORTRAN IV! (:-)) > 'Image is convinient for integer and enumeration output, and one can format > them in the rare case where that is necessary. But it is useless for float > output -- manual reformatting the output of 'Image would round the results > incorrectly. Which is why Float 'Image must have parameters! > Ada has few built-in facilities because it's primary purpose is to support > the development of proper ADTs. Ease of writing is not a goal at all, and in > most cases, the extra text is valuable to compilers and tools (even if it is > not so valuable to human readers). How is this related to attribute 'Image lacking necessary parameters? Why generic function having such parameters is OK, while 'Image with same parameters is not? -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
On 2023-08-20 09:53, G.B. wrote: > Could there be a language defined type F whose purpose is to support > the description of formats? Objects of type F would "configure" > what 'Image does when computing a representation of a date, a number, ... Not without multiple dispatch support and classes: Type x Format [ x Target ] Otherwise you get an untyped mess as in C: printf ("%s", 123); In the case of 'Image the dispatch is hard-wired. The compiler generates it according to one of built-in classes like 'integer type'. So yes it would be no problem to add parameters specific to each of the classes as well as common parameters like padding or alignment inside a field. But it will never ever happen. You seem suggesting a class-wide parameter type instead: type Format_Type is tagged record Width : Natural := 0; Alignment : Alignment_Type := Left; Padding : Character := ' '; end record; type Integer_Format is new Format_Type with record Plus_Sign : Boolean := False; Base : Base_Type := 10; end record; X'Image (Format => Format_Type'Class) This still requires a change that will be outright rejected on highest philosophical grounds. (:-)) However with a Format_Type you do not need 'Image. You can simply use a binary operation, e.g. function "/" (Value : Integer; Format : Integer_Format) return String; So would do Put_Line ("X=" & X / (Width=>10, Padding=>'0', Alignment=>Right)); instead of Put_Line ("X=" & X'Image (Width=>10, Padding=>'0', Alignment=>Right)); Of course it must be generic, which kills all fun. Ergo 1. Compiler magic is necessary because the language type system is too weak to express things like formatting. 2. No proposal however useful and reasonable will survive ARG because of #1. 3. Use a library that does the stuff. E.g. http://www.dmitry-kazakov.de/ada/strings_edit.htm#Integer_Edit -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
On 19.08.23 17:27, Jeffrey R.Carter wrote: > On 2023-08-19 11:14, J-P. Rosen wrote: >> On 18/08/2023 08:18, Rod Kay wrote: >>> >>> Would it be possible/desirable to allow the 'Image attribute to have formatting parameters ? Something along the lines of ... >> >> The intent of the 'Image attribute is to have a quick representation, mainly for debugging purposes. If you want nice formatted output, use the Put procedure on String from Text_IO > (...) > The obvious solution is to have a library containing appropriate functions, which can be built around the Put procedures while still being functions. Such functions would need to be generic, unlike attribute functions which are automatically available for all types. > > The conflict between this common need and the minimal functionality provided by 'Image results in such requests. It seems desirable for the language to provide such functions, and extending the 'Image functions seems like a reasonable way for it to do so, regardless of the original intentions for the attribute. So, also - See how other languages address formats (good bits, bad bits). - Consider use cases. - I/O is the program(mer)'s raison d'être. Can we easily Put something into a stream without the help of a suitable library? Could there be a language defined type F whose purpose is to support the description of formats? Objects of type F would "configure" what 'Image does when computing a representation of a date, a number, ... My_Length'Image (Arg => diameter, Format => ___); Some use cases: - I18n of number formats (cf ARM F.3), CHF 1'234'000.– - Handle ubiquitous ISO formats of date-time (as mentioned below; also cf. ARM 9.6.1) - reporting, - integrate own output with output of other system components (a site-wide monitoring system searches outputs, say) - fill in templates when these do not support formatting - 'Input an object of type F at run-time, so that program's use of 'Image can be changed according to customer's local expectations. - support the formalized exchange of "numerical" data in heterogeneous systems, using text streams. These use cases are about the O of I/O. By symmetry, it would be nice to have implementations of Ada that support the I part of this kind of I/O, I think, with work to be split between implementers and programmers. My_Length'Value (Arg => diameter, Format => ___); Or perhaps multimethods that take a stream and a format when they need to write a value? > One library with such functions is the PragmAda Reusable Components (https://github.com/jrcarter/PragmARC). The package PragmARC.Images (https://github.com/jrcarter/PragmARC/blob/Ada-12/pragmarc-images.ads) provides such functions for integer and floating-point types. Function PragmARC.Images.Image is an instantiation for Standard.Integer. > > PragmARC.Date_Handler (https://github.com/jrcarter/PragmARC/blob/Ada-12/pragmarc-date_handler.ads) provides image functions for dates and times; although the language now provides a function for a date-time image, Date_Handler continues to be useful as it provides for customized formats rather than the single format provided by Ada.Calendar.Formatting. Many users also find the semantics of the latter's time-zone parameter to be confusing. > > (ISO/IEC 8652:2023 provides a date-time image function the returns the image for the local time zone, but as there are no compilers* for this version of the language, I don't consider that relevant.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain, Size: 3648 bytes --] The profile of the Image attribute is: X'Image where X is an object of any type (or value of most types). And the old, unnecessary form was: S'Image(X) where S and X are of any type. If one tries to add parameters to this, one gives up this nice form for a mis-mash of profiles for various classes of types. Moreover, the result no longer composes in the obvious way (necessary to have Image for records and arrays). Additionally, one ends up with a magic mechanism that only the compiler can use. That *never* is a good idea. Especially as there now is a way to allow Image to support user-defined types. It would seem necessary to also support user-defined formatting parameters (else one has magic only applicable to a handful of language defined types). Attributes do not allow named parameters outside a few special cases, and *never* allow reordering of parameters. Does that need to change, too? Float input/output in particular is very large, especially when all of the formatting options are included. Do you really want to drag that into *every* Ada program, whether it uses it or not?? 'Image is convinient for integer and enumeration output, and one can format them in the rare case where that is necessary. But it is useless for float output -- manual reformatting the output of 'Image would round the results incorrectly. Ada has few built-in facilities because it's primary purpose is to support the development of proper ADTs. Ease of writing is not a goal at all, and in most cases, the extra text is valuable to compilers and tools (even if it is not so valuable to human readers). If it was up to me, I would eliminate most of the shortcuts from Ada and require everything to be written out. (IDEs could/should do most of that for you anyway, so the extra text is not adding much effort.) Ergo, I hope this idea is dead-on-arrival. I certainly won't be involved in it, that's for sure. Randy. "moi" <findlaybill@blueyonder.co.uk> wrote in message news:kkca55F9sn7U1@mid.individual.net... > On 19/08/2023 10:14, J-P. Rosen wrote: >> Le 18/08/2023 à 10:25, Luke A. Guest a écrit : >>> On 18/08/2023 08:18, Rod Kay wrote: >>>> Hello.all, >>>> There has been some recent discussion on #ada irc regarding formatted >>>> output. >>>> >>>> Would it be possible/desirable to allow the 'Image attribute to have >>>> formatting parameters ? Something along the lines of ... >>>> >>>> put_Line (some_Integer'Image (Width => 5, Padding => '0')); >>>> >>>> ... and similar 'Image attribute parameters for other types. >>>> >>>> If the parameters have defaults, then there should not be any backwards >>>> compatibility issues (I think). >>> >>> I wanted them for ages, but there was a conversation ages ago where >>> someone on here said attributes were for "debugging only," yet that's >>> not what the arm says. >>> >> The intent of the 'Image attribute is to have a quick representation, >> mainly for debugging purposes. If you want nice formatted output, use the >> Put procedure on String from Text_IO. >> > > My code uses 'Image heavily, because it is usually the neatest and the > clearest way to format many strings that mingle words and numbers. > > I sometimes have to pass the result of 'Image to a function that > implements the kind of functionality people are asking for, > and it would be even neater and clearer if I could get that with > parameters to 'Image itself. > > None of that output has anything to do with debugging. > > -- > Bill F. >
On 19/08/2023 10:14, J-P. Rosen wrote:
> Le 18/08/2023 à 10:25, Luke A. Guest a écrit :
>> On 18/08/2023 08:18, Rod Kay wrote:
>>> Hello.all,
>>> There has been some recent discussion on #ada irc regarding
>>> formatted output.
>>>
>>> Would it be possible/desirable to allow the 'Image attribute to
>>> have formatting parameters ? Something along the lines of ...
>>>
>>> put_Line (some_Integer'Image (Width => 5, Padding => '0'));
>>>
>>> ... and similar 'Image attribute parameters for other types.
>>>
>>> If the parameters have defaults, then there should not be any
>>> backwards compatibility issues (I think).
>>
>> I wanted them for ages, but there was a conversation ages ago where
>> someone on here said attributes were for "debugging only," yet that's
>> not what the arm says.
>>
> The intent of the 'Image attribute is to have a quick representation,
> mainly for debugging purposes. If you want nice formatted output, use
> the Put procedure on String from Text_IO.
>
My code uses 'Image heavily, because it is usually the neatest and the
clearest way to format many strings that mingle words and numbers.
I sometimes have to pass the result of 'Image to a function that
implements the kind of functionality people are asking for,
and it would be even neater and clearer if I could get that with
parameters to 'Image itself.
None of that output has anything to do with debugging.
--
Bill F.
On 2023-08-19 11:14, J-P. Rosen wrote: > On 18/08/2023 08:18, Rod Kay wrote: >> >> Would it be possible/desirable to allow the 'Image attribute to have >> formatting parameters ? Something along the lines of ... > > The intent of the 'Image attribute is to have a quick representation, mainly for > debugging purposes. If you want nice formatted output, use the Put procedure on > String from Text_IO. There is a common problem across many types and problem domains of having a function that returns a string of an appropriate length representing a value of the type with desired formatting. Common examples include numeric values, dates, and times. The resulting string is usually combined with other information into a message that may be stored in memory for a while, though it is rare for it not to be output eventually. As an example, the message may be put on a protected queue for later output by a logging task. Ada 83 tended not to include anything that the developer could implement; there was no math library or image functions for dates or times. The 'Image attribute was provided, but is unsuited for most such uses. The use of the Text_IO generic sub-pkg Put procedures that output to strings is not convenient because they are procedures, not functions. Later versions of Ada included more support for such needs, but not for numeric values. The obvious solution is to have a library containing appropriate functions, which can be built around the Put procedures while still being functions. Such functions would need to be generic, unlike attribute functions which are automatically available for all types. The conflict between this common need and the minimal functionality provided by 'Image results in such requests. It seems desirable for the language to provide such functions, and extending the 'Image functions seems like a reasonable way for it to do so, regardless of the original intentions for the attribute. One library with such functions is the PragmAda Reusable Components (https://github.com/jrcarter/PragmARC). The package PragmARC.Images (https://github.com/jrcarter/PragmARC/blob/Ada-12/pragmarc-images.ads) provides such functions for integer and floating-point types. Function PragmARC.Images.Image is an instantiation for Standard.Integer. PragmARC.Date_Handler (https://github.com/jrcarter/PragmARC/blob/Ada-12/pragmarc-date_handler.ads) provides image functions for dates and times; although the language now provides a function for a date-time image, Date_Handler continues to be useful as it provides for customized formats rather than the single format provided by Ada.Calendar.Formatting. Many users also find the semantics of the latter's time-zone parameter to be confusing. (ISO/IEC 8652:2023 provides a date-time image function the returns the image for the local time zone, but as there are no compilers* for this version of the language, I don't consider that relevant. (*A compiler for a version of the language implements the entire core language of that version of the ARM.) -- Jeff Carter "The men get one hot meal a day: a bowl of steam." Take the Money and Run 145
On 2023-08-19 13:56, J-P. Rosen wrote: > Le 19/08/2023 à 12:03, Dmitry A. Kazakov a écrit : >> On 2023-08-19 11:14, J-P. Rosen wrote: >> >>> The intent of the 'Image attribute is to have a quick representation, >>> mainly for debugging purposes. >> >> It seems that for the vast majority of Ada users this intent was wrong... > The vast majority of Ada users ignore a number of useful features > provided by the language, and keep asking for improvements that are > already there... Or these features are not that useful? Language users and designers have often different perspectives... >>> If you want nice formatted output, use the Put procedure on String >>> from Text_IO. >> >> Put does not supersede 'Image. Put is I/O. 'Image is pure string >> formatting. Put is generic and requires instantiation of some package >> with some difficult to guess name. 'Image is built-in [statically] >> dispatching and generated automatically by the compiler. >> > Yes, put has nothing to do with 'Image. Yes, put requires instantiation. > So what? Ada is more verbose, in favor of stricter typing. I don't see how instantiation is stricter typing. In fact instantiation introduces overloading (static ad-hoc polymorphism) which was always frowned upon at as less type safe than overriding. > Ease of > reading over ease of writing has always been a major design principle of > Ada - although I confess it had a bad effect on its popularity, people > want to write fast and ignore long term maintenance issues. I don't buy this either. It is Put (X) vs. X'Image equally readable and writable. If you refer to the instantiation noise or with/use clauses you would require to but somewhere far above in the package. That is not ease of reading. That is just meaningless noise. > If you want formatting on an integer type (with or without IO), you > instantiate Integer_IO. I don't find it hard to guess the name... Maybe > you had something else in mind? Yes, all other types that might require formatting. I doubt anybody, but a language lawyer could name the package appropriate for formatting a fixed-point type without looking into the RM. Which is absolutely unneeded as 'Image would be perfectly OK if it had necessary parameters. All that generic text I/O packages are unnecessary as stream I/O case perfectly illustrates. Ada 95 did stream I/O if not right, but far better making 'Read, 'Write etc attributes overridable. The problem of generic mess solved. We do not have and do not need any generics for stream I/O. Good riddance. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
Le 19/08/2023 à 12:03, Dmitry A. Kazakov a écrit : > On 2023-08-19 11:14, J-P. Rosen wrote: > >> The intent of the 'Image attribute is to have a quick representation, >> mainly for debugging purposes. > > It seems that for the vast majority of Ada users this intent was wrong... The vast majority of Ada users ignore a number of useful features provided by the language, and keep asking for improvements that are already there... >> If you want nice formatted output, use the Put procedure on String >> from Text_IO. > > Put does not supersede 'Image. Put is I/O. 'Image is pure string > formatting. Put is generic and requires instantiation of some package > with some difficult to guess name. 'Image is built-in [statically] > dispatching and generated automatically by the compiler. > Yes, put has nothing to do with 'Image. Yes, put requires instantiation. So what? Ada is more verbose, in favor of stricter typing. Ease of reading over ease of writing has always been a major design principle of Ada - although I confess it had a bad effect on its popularity, people want to write fast and ignore long term maintenance issues. If you want formatting on an integer type (with or without IO), you instantiate Integer_IO. I don't find it hard to guess the name... Maybe you had something else in mind? -- J-P. Rosen Adalog 2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX https://www.adalog.fr https://www.adacontrol.fr
On 19/08/2023 11:03, Dmitry A. Kazakov wrote: > On 2023-08-19 11:14, J-P. Rosen wrote: > >> The intent of the 'Image attribute is to have a quick representation, >> mainly for debugging purposes. > Where does it say this in the rm? We certainly were not taught that 'image was for debugging at uni. > It seems that for the vast majority of Ada users this intent was wrong... Yup.
On 2023-08-19 11:14, J-P. Rosen wrote: > The intent of the 'Image attribute is to have a quick representation, > mainly for debugging purposes. It seems that for the vast majority of Ada users this intent was wrong... > If you want nice formatted output, use > the Put procedure on String from Text_IO. Put does not supersede 'Image. Put is I/O. 'Image is pure string formatting. Put is generic and requires instantiation of some package with some difficult to guess name. 'Image is built-in [statically] dispatching and generated automatically by the compiler. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
Le 18/08/2023 à 10:25, Luke A. Guest a écrit : > On 18/08/2023 08:18, Rod Kay wrote: >> Hello.all, >> There has been some recent discussion on #ada irc regarding >> formatted output. >> >> Would it be possible/desirable to allow the 'Image attribute to >> have formatting parameters ? Something along the lines of ... >> >> put_Line (some_Integer'Image (Width => 5, Padding => '0')); >> >> ... and similar 'Image attribute parameters for other types. >> >> If the parameters have defaults, then there should not be any >> backwards compatibility issues (I think). > > I wanted them for ages, but there was a conversation ages ago where > someone on here said attributes were for "debugging only," yet that's > not what the arm says. > The intent of the 'Image attribute is to have a quick representation, mainly for debugging purposes. If you want nice formatted output, use the Put procedure on String from Text_IO. -- J-P. Rosen Adalog 2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX https://www.adalog.fr https://www.adacontrol.fr
Rod Kay <rodakay5@gmail.com> writes:
> There has been some recent discussion on #ada irc regarding
> formatted output.
>
> Would it be possible/desirable to allow the 'Image attribute to
> have formatting parameters ? Something along the lines of ...
>
>
> put_Line (some_Integer'Image (Width => 5, Padding => '0'));
>
>
> ... and similar 'Image attribute parameters for other types.
>
>
> If the parameters have defaults, then there should not be any
> backwards compatibility issues (I think).
TeleSoft's compiler (which I worked on) had 'Extended_Image and
'Extended_Value attributes that worked like that. I found them quite
useful -- especially as an easy way to drop the leading space on
Integer'Image.
One small problem was that we had different parameters for integer
and enumeration types, which introduced an ambiguity for discrete
formal types.
--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */
On 18/08/2023 08:18, Rod Kay wrote:
> Hello.all,
>
>
> There has been some recent discussion on #ada irc regarding
> formatted output.
>
> Would it be possible/desirable to allow the 'Image attribute to have
> formatting parameters ? Something along the lines of ...
>
>
> put_Line (some_Integer'Image (Width => 5, Padding => '0'));
>
>
> ... and similar 'Image attribute parameters for other types.
>
>
> If the parameters have defaults, then there should not be any
> backwards compatibility issues (I think).
I wanted them for ages, but there was a conversation ages ago where
someone on here said attributes were for "debugging only," yet that's
not what the arm says.
Hello.all, There has been some recent discussion on #ada irc regarding formatted output. Would it be possible/desirable to allow the 'Image attribute to have formatting parameters ? Something along the lines of ... put_Line (some_Integer'Image (Width => 5, Padding => '0')); ... and similar 'Image attribute parameters for other types. If the parameters have defaults, then there should not be any backwards compatibility issues (I think). Any thoughts ? Regards.
"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message
news:ubhpme$370q7$1@dont-email.me...
> On 2023-08-15 10:40, G.B. wrote:
>> On 14.08.23 10:31, Dmitry A. Kazakov wrote:
>>>
>>> P.S. I always wanted static functions in Ada for the purpose of all
>>> static initializations of objects like maps etc.
>>>
>>
>> If data form the equivalent of a static Ada array,
>> thus a mapping from an index type to a value type,
>> could you approximate the static initialization
>> of maps using expression functions?
>
> In general case no. Initialization cannot be decomposed into functions.
> E.g. when requires global [yet static] data, many places to set etc.
>
> P.S. Expression functions are evil. I wonder why there is no expression
> gotos and labels? If you sell your soul to the devil, get the whole
> package! (:-))
Ada only allows expressions to be evaluated at elaboration time (outside of
generic instantations), and expressions have a well-defined and simple
control flow (even accounting for conditional expressions and quantified
expressions, both of which implicitly appear in aggregates even in Ada 83 --
allowing programmers to write them explicitly makes the code more readable
than the horrible work-arounds commonly used pre-Ada 2012). Gotos and labels
have arbitrary control flow, which can be much harder to analyze. (Janus/Ada
converts the majority of code into an expression form for optimization --
essentially most id statements become if expressions, and so on. It simply
punts when the control flow is too complex to convert, so the unrestricted
use of gotos effectively prevents most optimization as well as static
analysis.)
If it was up to me, I would have left out declare expressions and quantified
expressions, so the capabilities of expression functions would have been
much more limited. But it seems valuable to be able to abstract an
expression without changing the semantics (as requiring a separate body
does).
Randy.
So I found https://github.com/godunko/matreshka which appears to be the new home for the project, and it compiles OK on FreeBSD amd64. -- To health and anarchy
About twice a year we try to advertise the #ada channel on the Libera IRC network. The channel continues to be active and friendly. These days it averages about 63 users at a time, large enough to support lively and informative discussions but small enough so it's not a madhouse. The user numbers did suffer on the move when Freenode imploded. Topics range all over the map, from building the latest GNAT to writing an OS in Ada to daily Ada programming issues to how to use PolyOrb to use the Distributed Systems Annex. The stated topic is discussing Ada in the context of free and open-source software, but commercial users are equally welcome. So fire up your favorite IRC client and come join us! The network is homed at irc.Libera.chat, but has servers all over the world. Visit www.Libera.chat on the web for details. Hope to see you soon!
On 2023-08-15 10:40, G.B. wrote: > On 14.08.23 10:31, Dmitry A. Kazakov wrote: >> >> P.S. I always wanted static functions in Ada for the purpose of all >> static initializations of objects like maps etc. >> > > If data form the equivalent of a static Ada array, > thus a mapping from an index type to a value type, > could you approximate the static initialization > of maps using expression functions? In general case no. Initialization cannot be decomposed into functions. E.g. when requires global [yet static] data, many places to set etc. P.S. Expression functions are evil. I wonder why there is no expression gotos and labels? If you sell your soul to the devil, get the whole package! (:-)) -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
On Monday, August 14, 2023 at 2:30:08 PM UTC-6, wrote: > I am interested in cross-compilers for Linux boards such as the Raspberry Pi. I have successfully built cross-compilers for GNAT/GCC 12.3.1 on Debian 12 using the latest Arm GNU manifest and Linaro ABE, and Debian 12 has system packages for GNAT/GCC 12.2.0, native and cross, as well. > > It isn't clear to me from the GCC release notes how complete the support for Ada 2022 is in GNAT/GCC 12.2.0 or 12.3.1. Is there a document or table somewhere that keeps track of that? And how does GCC 12 compare with GCC 13 WRT Ada 2022? Simon Answered another question after yours that was helpful, related information. You may be able to find most of what you are looking for with the link in his answer: https://blog.adacore.com/ada-202x-support-in-gnat
On 14.08.23 10:31, Dmitry A. Kazakov wrote:
>
> P.S. I always wanted static functions in Ada for the purpose of all static initializations of objects like maps etc.
>
If data form the equivalent of a static Ada array,
thus a mapping from an index type to a value type,
could you approximate the static initialization
of maps using expression functions?
Simplifying example:
package sttc is
type Key is range 1 .. 7;
type Value is new Character;
type Cursor is private;
function lookup (K: Key) return Cursor;
function element (C: Cursor) return Value;
private
type Cursor is new Key;
end sttc;
package body sttc is
function lookup (K: Key) return Cursor is (Cursor (K));
function element (C: Cursor) return Value is
(case C is
when 1 => 'M',
when 2 => 'M',
when 3 => 'X',
when 4 => 'X',
when 5 => 'I',
when 6 => 'I',
when 7 => 'I'
);
end sttc;
On Monday, August 14, 2023 at 10:03:01 AM UTC-6, Dmitry A. Kazakov wrote:
> On 2023-08-14 17:10, Micah Waddoups wrote:
> [...]
>
> > procedure Unifont_Hex_To_Ada is
>
> [...]
>
> What are you going to do with this?
>
> 1. This is not a font usable in a GUI framework.
>
> 2. This is not a drawable in-memory image for a GUI framework either.
> Provided, you wanted to render obtained images manually. These images
> must be in a format supported by the corresponding engine.
>
> E.g. GTK uses Pixbuf representation for drawable in-memory images. Which is
>
> type Pixbuf_Image is array (Natural range 0..N*M-1) of GUChar;
> pragma Convention (C, Pixbuf_Image);
>
> containing 4 channels RGB + alpha, row-wise.
>
> And, no, normally you cannot draw in an arbitrary OS window.
>
> If you are so keen to use GNU Unifont, why do not you install it from
> its available formats like TrueType and be done with that? What is wrong
> with other fixed-size fonts?
>
> Why do you want to render glyphs manually instead of using existing OS
> facilities and GUI libraries? You cannot get around these libraries
> without rewriting device drivers and who knows what else making the code
> highly non-portable.
> --
> Regards,
> Dmitry A. Kazakov
> http://www.dmitry-kazakov.de
Jeff, Thanks for testing that. I am currently too busy with work to attempt much more for a day or two, but I am excited that the less fancy method works!
Dmitry, of course, you are correct. This was an attempt to take an image of the font source. I assumed a few concessions against size efficiency to make it slightly more speed efficient would be needed, and it turned out I have to do the bit value extraction without the Boolean + 'with Pack' combo. I can figure out what went wrong there later, since making the method easier to use in different languages has its benefits, so I don't need to use that method.
The rendering is done with a small cache of per-need rendered Glyphs - each rendered glyph is at least eight times larger before any styling or transformation. Rendering all the glyphs at once takes up more memory than is needed and presupposes the destination format. So, in reality, more processor work is being done by doing it in stages, but less is being done in each stage, so there is more room for other processing at each stage. This is just the raw bitmap font that I want in the program without having to process and read the hex file every time it loads (that would be very inefficient design).
In the first rendering, the glyphs that are actually used are rendered into a cache with only Alpha values. This is essentially gray-scale and is the value-map used for any transformations, glyph combining, and plotting on a per-line image plot map (which is another abstraction by line and index/column of just the first..last pixel boundaries). The plot map can very quickly be changed for insertions, deletions, changing text direction or flow, etc. and only at the final rendering of the View-able area is the Alpha transformed into full color (4-byte with alpha) to be sent to the GL, framebuffer, GTK, or other pixel-map handling system. Much like modern rendering systems, a lot of calculations happen behind the scenes at each key-press, only it is my attempt to combine it all into one library and scale it into a project that can be plugged into whatever graphics system is being used. It is probably slower in response to input than GTK or any native text handling system because effects, layers of glyph-combinations, markups (squiggle line, underline, etc), and colorization all go into the font rendering before it hits the graphics buffer, but it feels to me more correct and avoids having to add post-rendering effects as a later stage as much as possible. Markups are done late, just before rotation (if any), but that is just as it must be, since they are effectively a rendered element of a different size than the individual glyphs they markup, yet still done before the rendered map is turned over to the graphics system.
The reason people rely on device drivers, native widgets, and less-portable combinations of libraries is that they incorporate the features and functionality desired into them, including how to handle input. I am attempting to take the lowest level of input (key-presses, clicks, touch, etc) like a video game might, and outputting an image already rendered for display, thus replacing the normally convenient functionality provided by other systems. I am *not* trying to replace actual device drivers or rely on a particular operating system's device access scheme. That is why I am considering other well established libraries supporting GL or maybe SDL. Not all programs render text and input with the convenient systems, so this is nothing new. Also, since this scheme still tracks each character by line and index, even if I am only able to support text-mode terminal interface in one situation, that will only prevent using the full Unicode range of glyphs and combinations, not disable my ability to send/receive any given text with the display.
-Micah-
On 2023-08-14 17:10, Micah Waddoups wrote: [...] > procedure Unifont_Hex_To_Ada is [...] What are you going to do with this? 1. This is not a font usable in a GUI framework. 2. This is not a drawable in-memory image for a GUI framework either. Provided, you wanted to render obtained images manually. These images must be in a format supported by the corresponding engine. E.g. GTK uses Pixbuf representation for drawable in-memory images. Which is type Pixbuf_Image is array (Natural range 0..N*M-1) of GUChar; pragma Convention (C, Pixbuf_Image); containing 4 channels RGB + alpha, row-wise. And, no, normally you cannot draw in an arbitrary OS window. If you are so keen to use GNU Unifont, why do not you install it from its available formats like TrueType and be done with that? What is wrong with other fixed-size fonts? Why do you want to render glyphs manually instead of using existing OS facilities and GUI libraries? You cannot get around these libraries without rewriting device drivers and who knows what else making the code highly non-portable. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
On 2023-08-14 17:10, Micah Waddoups wrote:
>
> Jeff, you missed a digit - it's five F's 16#FFFFF# because that is as high as Unifont goes in my copy of the hex file. Of course the technique should be able to go higher if that changes, but Unicode is pretty exhaustive as it is and Unifont is meant to keep up with every version and addition to the Unicode code points, so I sincerely hope for no trouble for a while yet. I checked, and it seem my system has about 8 megabytes as the stack size limit, so with the ranges left empty it is not 32 megabytes, but still pretty big. Good looking code, by the way. Very easy to read. Mine is appended, but it was really a quick hack of a job with too little sleep. I probably should have done a Z Shell script (maybe take 20 seconds?), but I thought the two second efficiency of writing a compiled composer was worth it ...somehow...
You're right. Sorry for misreading that. But increasing Code_Point to include
16#F_FFFF# still works for me.
Unicode defines code points up to 16#10_FFFF#, but perhaps those over 16#F_FFFF#
are unused. Increasing Code_Point to include 16#10_FFFF# still works for me.
That's 34 MB. It won't fit on the stack, but luckily library-level constants
aren't allocated on the stack.
--
Jeff Carter
"I wave my private parts at your aunties."
Monty Python & the Holy Grail
13
On Monday, August 14, 2023 at 4:06:39 AM UTC-6, Jeffrey R.Carter wrote:
> On 2023-08-13 18:16, Micah Waddoups wrote:
> > I tried to compile the Unifont hex file, converted with a script into variable Ada code, but it went on forever, gradually blowing up my memory. I used an .ads file and aimed for a static build, but I suspect I would have hit the stack size limit for executables if I succeeded
> As I understand it, the file in question is for code points 0 .. 16#FFFF#, with
> a maximum of 32 bytes per code point. A straightforward representation of this is
>
> package Unifont is
> type Byte is mod 2 ** 8 with Size => 8;
>
> type Line is array (1 .. 2) of Byte with Size => 16;
>
> type Bitmap is array (1 .. 16) of Line with Size => 256;
>
> function Width_8 (Map : in Bitmap) return Boolean is
> (for all L of Map => L (2) = 0);
>
> type Code_Point is mod 16#FFFF# + 1;
>
> type Font_Map is array (Code_Point) of Bitmap with Size => 2 ** 24;
>
> Font : constant Font_Map := (others => (others => (others => 0) ) );
> end Unifont;
>
> Font will occupy 2 MB.
>
> We can test this with
>
> with Ada.Text_IO;
> with Unifont;
>
> procedure Unifont_Test is
> -- Empty
> begin -- Unifont_Test
> Ada.Text_IO.Put_Line (Item => Unifont.Font (0) (1) (1)'Image);
> end Unifont_Test;
>
> and see what happens:
>
> $ gnatmake -m -j0 -gnat12 -gnatan -gnato2 -O2 -fstack-check unifont_test.adb
> x86_64-linux-gnu-gcc-12 -c -gnat12 -gnatan -gnato2 -O2 -fstack-check
> unifont_test.adb
> x86_64-linux-gnu-gcc-12 -c -gnat12 -gnatan -gnato2 -O2 -fstack-check unifont.ads
> x86_64-linux-gnu-gnatbind-12 -x unifont_test.ali
> x86_64-linux-gnu-gnatlink-12 unifont_test.ali -O2 -fstack-check
> $ ./unifont_test
> 0
>
> so this representation seems to be workable. It should be trivial to write a
> program to read the file and produce the real array aggregate for Font.
>
> --
> Jeff Carter
> "I wave my private parts at your aunties."
> Monty Python & the Holy Grail
> 13
Thank you all for replying while I was working away from home.
Jeff, you missed a digit - it's five F's 16#FFFFF# because that is as high as Unifont goes in my copy of the hex file. Of course the technique should be able to go higher if that changes, but Unicode is pretty exhaustive as it is and Unifont is meant to keep up with every version and addition to the Unicode code points, so I sincerely hope for no trouble for a while yet. I checked, and it seem my system has about 8 megabytes as the stack size limit, so with the ranges left empty it is not 32 megabytes, but still pretty big. Good looking code, by the way. Very easy to read. Mine is appended, but it was really a quick hack of a job with too little sleep. I probably should have done a Z Shell script (maybe take 20 seconds?), but I thought the two second efficiency of writing a compiled composer was worth it ...somehow...
Niklas, I think you have the most actionable suggestions for me to test. Thank you.
Dmitry, Thank you for trying to understand. Since both methods of rendering fonts made available by GTK, I consider it GTK providing it. I don't want any more imports than I can provide easily with a static compile or as accompanying dynamic modules (reason hereafter mentioned), and Licensing needs to be the most permissive possible. The idea is to be able to create a shell or a variety of other programs using my library as a very focused kind of interface that supports more characters and more languages that my other most available options, so the font is important, even if I'm just drawing to the Linux frame buffer. I meant a transfer of code from one platform to another. Sometimes in a graphical window that acts like a text interface window, sometimes on the linux frame buffer, and in the extreme case some times on the text console without any particular font support. The main collection of code is supposed to support all that with very limited modification to say transfer from Linux to macOS or MS Windows? I hope this s answered your questions.
Oh, and to all, I have already abandon the idea of using Boolean with Pack, since it no longer seems to work and was a bit *too* verbose
pragma Ada_2012;
pragma Wide_Character_Encoding (UTF8);
with Ada.Text_IO;
use Ada.Text_IO;
procedure Unifont_Hex_To_Ada is
Target_Name: String := "./src/unifont.ads";
Source_Name: String := "unifont_all-15.0.06.hex";
Target: aliased File_Type;
Source: aliased File_Type;
Buffer: aliased String (1 .. 96) := (others=>' ');
Index, F: Positive := 1;
Previous, Current, Length, L: Natural := 0;
Finished: aliased Boolean:= False;
subtype Hex_Character is Character range '0' .. 'f'
with Static_Predicate=> (Hex_Character in '0' .. '9') or (Hex_Character in 'A' .. 'F') or (Hex_Character in 'a' .. 'f');
type Byte is mod 2 **8;
type Bit is mod 8;
--type Bytes is array (Natural range <>) of aliased Byte;
Bit_X: Bit := 0;
Byte_X: Byte := 0;
function Find (Item: Character)
return Natural
is
begin
for
N in Buffer'Range
loop
if Item = Buffer(N)
then return N;
end if;
end loop;
return 0;
end Find;
function Enum return Natural
is
First: Positive := 1;
Last: Natural := Integer'Max ((Find (':') -1), 0);
begin
return R: Natural
do
R := Natural'Value ("16#" &Buffer (First..Last) &'#');
end return;
end Enum;
procedure Next_Byte
is
S: String renames Buffer (F .. L);
begin
loop
if
(Index in S'Range) and (Index +1 in S'Range)
then
exit;
else
Index := S'First;
if
(Index in S'Range) and (Index +1 in S'Range)
then
exit;
else
raise Program_Error with "Next_Byte-> Somehow there are no Hex codes in string... line " &Current'Img &", string => " & S;
end if;
end if;
end loop;
if
S (Index) in Hex_Character
and
S (Index +1) in Hex_Character
then
Byte_X := Byte'Value ("16#" &S (Index..Index +1) &"#");
Bit_X := 0;
Index := Index +2;
end if;
end Next_Byte;
procedure Next_Line
is
begin
for
N in Buffer'First .. Length
loop
Buffer (N):= ' ';
end loop;
begin
Get_Line (Source, Buffer, Length);
exception
when others => null;
end;
if
Length < 32
then
Put_Line (Standard_Error, "empty or incomplete line at code point " &Natural'Image (Enum) &" (" &Current'Img &" + 1)");
else
Previous:= Current;
Current:= Enum;
if
((Previous + 1) = Current)
or else (Current = 0)
then
F:= Find (':') +1;
L:= Length;
Next_Byte;
else
F:= Find (':') +1;
L:= Length;
Next_Byte;
Put_Line (Standard_Error, " Missing character range in Source: " &Previous'Img &" .. " &Current'Img);
end if;
end if;
end Next_Line;
subtype Index_Type is Natural range 0 .. 16#FFFFF#;
subtype Y_Type is Integer range 1 .. 16;
subtype X_Type is Integer range 1 .. 16;
type Size_Type is
record
Y: aliased Y_Type:= Y_Type'First;
X: aliased X_Type:= X_Type'First;
end record;
type Size_Set_Type is array (Index_Type) of aliased Size_Type;
type Size_Set_Access is access all Size_Set_Type;
function Dot return String is
begin
if
1 = ((Byte_X / 2 **(7 - Natural(Bit_X))) and 1)
then
if
Bit_X = Bit'Last
then
Next_Byte;
else
Bit_X := Bit_X +1;
end if;
return "True";
else
if
Bit_X = Bit'Last
then
Next_Byte;
else
Bit_X := Bit_X +1;
end if;
return "False";
end if;
end Dot;
Cache_Size: Size_Set_Access := new Size_Set_Type'(others => (16, 8));
Size: Size_Set_Type renames Cache_Size.all;
begin
begin
Open (Source, In_File, Source_Name);
exception
when others =>
raise Status_Error with " Source File not found: " &Source_Name;
end;
begin
Create (Target, Out_File, Target_Name);
exception
when others =>
Open (Target, Out_File, Target_Name);
end;
begin
Put_Line (Target, "pragma Ada_2012;");
Put_Line (Target, "pragma Wide_Character_Encoding (UTF8);");
New_Line (Target, 2);
--Put_Line (Target, "with ada.unchecked_conversion;");
--New_Line (Target, 2);
Put_Line (Target, "package Unifont is");
Put_Line (Target, "subtype Index_Type is Wide_Wide_Character range Wide_Wide_Character'Val (0) .. Wide_Wide_Character'Val (16#FFFFF#);");
Put_Line (Target, "subtype Y_Type is Integer range 1 .. 16;");
Put_Line (Target, "subtype X_Type is Integer range 1 .. 16;");
Put_Line (Target, "type Size_Type is record Y: aliased Y_Type := 1; X: aliased X_Type := 1; end record;");
Put_Line (Target, "type Size_Set_Type is array (Index_Type) of aliased Size_Type;");
Put_Line (Target, "type Glyph_Type is array (Y_Type, X_Type) of Boolean");
Put_Line (Target, "with Pack, Size=> 256;");
Put_Line (Target, "type Glyph_Set_Type is array (Index_Type) of aliased Glyph_Type;");
Put_Line (Target, "Glyph: constant Glyph_Set_Type :=");
Put (Target, "(");
loop
exit when End_Of_File (Source);
Next_Line; -- Load Next Line and extract Code Point index
if
Length > 64
then
Size (Current) := (16, 16);
Put_Line (Target, "Wide_Wide_Character'Val (" &Integer'Image(Current) &") =>");
Put (Target, "(");
for Y in 1 .. 16
loop
Put_Line (Target, Y'Img &" =>");
Put (Target, "(");
for X in 1 .. 16
loop
if
X < 16
then
Put (Target, Dot &", ");
else
Put (Target, Dot &")");
end if;
end loop;
if
Y < 16
then
Put_Line (Target, ",");
else
Put_Line (Target, "),");
end if;
end loop;
elsif
Length > 32
then
Put_Line (Target, "Wide_Wide_Character'Val (" &Integer'Image(Current) &") =>");
Put (Target, "(");
for Y in 1 .. 16
loop
Put_Line (Target, Y'Img &" =>");
Put (Target, "(");
for X in 1 .. 8
loop
Put (Target, Dot &", ");
end loop;
for X in 9 .. 16
loop
if
X < 16
then
Put (Target, "False, ");
else
Put (Target, "False)");
end if;
end loop;
if
Y < 16
then
Put_Line (Target, ",");
else
Put_Line (Target, "),");
end if;
end loop;
end if;
end loop;
Close (Source);
Put_Line (Target, "others => (others => (others => False)));");
New_Line (Target);
Put_Line (Target, "Size: constant Size_Set_Type :=");
Put (Target, "(");
for N in Index_Type'Range
loop
Put (Target, "Wide_Wide_Character'Val (" &Integer'Image(N) &") =>");
Put (Target, "(" &Integer'Image(Size(N).Y) &", " &Integer'Image(Size(N).X) &")");
if
N < Index_Type'Last
then
Put_Line (Target, ",");
else
Put_Line (Target, ");");
end if;
end loop;
Put_Line (Target, "end Unifont;");
Put_Line (Target, "");
Put_Line (Target, "");
Put_Line (Target, "");
Put_Line (Target, "");
Put_Line (Target, "");
Put_Line (Target, "");
Put_Line (Target, "");
Put_Line (Target, "");
Put_Line (Target, "");
Put_Line (Target, "");
Put_Line (Target, "");
Put_Line (Target, "");
Put_Line (Target, "");
Put_Line (Target, "");
Put_Line (Target, "");
Put_Line (Target, "");
Close (Target);
end;
end Unifont_Hex_To_Ada;
On 2023-08-13 18:16, Micah Waddoups wrote:
> I tried to compile the Unifont hex file, converted with a script into variable Ada code, but it went on forever, gradually blowing up my memory. I used an .ads file and aimed for a static build, but I suspect I would have hit the stack size limit for executables if I succeeded
As I understand it, the file in question is for code points 0 .. 16#FFFF#, with
a maximum of 32 bytes per code point. A straightforward representation of this is
package Unifont is
type Byte is mod 2 ** 8 with Size => 8;
type Line is array (1 .. 2) of Byte with Size => 16;
type Bitmap is array (1 .. 16) of Line with Size => 256;
function Width_8 (Map : in Bitmap) return Boolean is
(for all L of Map => L (2) = 0);
type Code_Point is mod 16#FFFF# + 1;
type Font_Map is array (Code_Point) of Bitmap with Size => 2 ** 24;
Font : constant Font_Map := (others => (others => (others => 0) ) );
end Unifont;
Font will occupy 2 MB.
We can test this with
with Ada.Text_IO;
with Unifont;
procedure Unifont_Test is
-- Empty
begin -- Unifont_Test
Ada.Text_IO.Put_Line (Item => Unifont.Font (0) (1) (1)'Image);
end Unifont_Test;
and see what happens:
$ gnatmake -m -j0 -gnat12 -gnatan -gnato2 -O2 -fstack-check unifont_test.adb
x86_64-linux-gnu-gcc-12 -c -gnat12 -gnatan -gnato2 -O2 -fstack-check
unifont_test.adb
x86_64-linux-gnu-gcc-12 -c -gnat12 -gnatan -gnato2 -O2 -fstack-check unifont.ads
x86_64-linux-gnu-gnatbind-12 -x unifont_test.ali
x86_64-linux-gnu-gnatlink-12 unifont_test.ali -O2 -fstack-check
$ ./unifont_test
0
so this representation seems to be workable. It should be trivial to write a
program to read the file and produce the real array aggregate for Font.
--
Jeff Carter
"I wave my private parts at your aunties."
Monty Python & the Holy Grail
13
On 2023-08-14 11:30, Kevin Chadwick wrote: > Sorry, my client hung up and I guess sent multiple copies whilst I was too > patient. My client (Thunderbird) hung today too. Coincidence? Where is my trusted tin foil hat? (:-)) -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
On 2023-08-14 11:25, Kevin Chadwick wrote: >> Doing something like that for bitmap fonts is just as simple. The only >> minor issue is creating an index map: code point to the bitmap image >> name (array), because a flat array would blow out. > > What does blow out mean in this context? If you tried: type Font_Type is array (Code_Point) of Bitmap_Ptr; The range of code points is 0..16#10FFFF#. E.g. when I implemented Ada.Strings.Maps for Unicode, I could not use such arrays either as the native ASCII implementation does. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
Sorry, my client hung up and I guess sent multiple copies whilst I was too patient. -- Regards, Kc
>Doing something like that for bitmap fonts is just as simple. The only
>minor issue is creating an index map: code point to the bitmap image
>name (array), because a flat array would blow out.
What does blow out mean in this context?
--
Regards, Kc
On 2023-08-14 10:07, Niklas Holsti wrote: > I'm not familiar with the structure of the Unifont file, but if it is > something like a table with rows and columns, it should be rather easy > to translate it into a list of assembly-language constant-data definitions. A comparable case. I have XPM to Ada translator (for having built-in images in GTK). It simply creates packages with declarations of initialized arrays. No stack issues. Doing something like that for bitmap fonts is just as simple. The only minor issue is creating an index map: code point to the bitmap image name (array), because a flat array would blow out. P.S. I always wanted static functions in Ada for the purpose of all static initializations of objects like maps etc. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
On 2023-08-14 02:29, Micah Waddoups wrote: > GUIs are a real problem for me because they are so sophisticated and automated that I can barely even attempt my own projects or a code base that transfers between graphical, terminal and other operating systems. Transfers what to where? > GTK, GL libraries, and SDL are great and I plan to use at least one of them, but only to render the image buffer and collect input from modern hotplug-able devices. GTK does not render any fonts. It uses other libraries for rendering, depending on the surface e.g. Pango for rendering in Cairo, which is vector graphics surfaces. As for crude bitmap fonts GTK just rely on the target OS back end to render them, e.g. Windows GDI. If you need a bitmap of a system font glyph, you render the text into the memory instead of a device context and take the result. Though I have no idea what and why are you trying to do. > If I can get around to it I might try to support pseudo virtual terminals like GNU Screen does, but just managing application spawns with all their input/output being configurable is likely enough for me right now. Any GUI has a text view widget or equivalent, e.g. GtkTextView in GTK. Most of them support bitmap drawable widgets where you can draw and render bitmap system fonts if you wanted to recreate a text view. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
On 2023-08-13 19:16, Micah Waddoups wrote: > I tried to compile the Unifont hex file, converted with a script into > variable Ada code, but it went on forever, gradually blowing up my > memory. I used an .ads file and aimed for a static build, but I > suspect I would have hit the stack size limit for executables if I > succeeded > > My request for insight is: (A) How do you recommend I compile the > Unifont into a form that is usable within my Ada program. Could you show a little of the script-generated Ada code, just for us to understand the approach you have taken to represent the Unifont file? While waiting for that, it may help the compiler if you disable the more advanced compiler optimizations, because some of them are super-linear in complexity and probably (but depending on the exact form of the Ada code) do not help for this case, anyway. > (I am thinking compiling C and importing, since C is so basic it > might just work, but even better would be Assembly and I don't know > how to import a large data variable compiled in Assembly or if I can > even compile that much data using Assembly... It should work, but > the compiler might complain and I still have to figure out the > importing part.) I'm not familiar with the structure of the Unifont file, but if it is something like a table with rows and columns, it should be rather easy to translate it into a list of assembly-language constant-data definitions. Assemblers are typically linear in complexity and should be able to handle large data definitions, assuming there is not a myriad of assembler labels that make references between different parts of the data structure. Exporting a data object from assembly to Ada is simple and does not depend on the size of the object (but I admit I don't know how this is done for dynamically linked libraries). The only part that needs thought is how to define the Ada type of the object, but if the Unifont file is a row-column table, in other words a list of "row" records, that should be straight-forward too. So I think the assembly-language solution is highly likely to work; its drawback, of course, is non-portability. But the constant-data definitions of most assembly languages are very similar to each other, so the assembler-generating script should be easy to port to different assembly languages.
On Sunday, August 13, 2023 at 3:19:55 PM UTC-6, DrPi wrote:
> Le 13/08/2023 à 18:16, Micah Waddoups a écrit :
> > I tried to compile the Unifont hex file, converted with a script into variable Ada code, but it went on forever, gradually blowing up my memory. I used an .ads file and aimed for a static build, but I suspect I would have hit the stack size limit for executables if I succeeded
> >
> > My request for insight is:
> > (A) How do you recommend I compile the Unifont into a form that is usable within my Ada program. (I am thinking compiling C and importing, since C is so basic it might just work, but even better would be Assembly and I don't know how to import a large data variable compiled in Assembly or if I can even compile that much data using Assembly... It should work, but the compiler might complain and I still have to figure out the importing part.)
> >
> > (B) Do you think this has a chance of succeeding if I compile the font as a shared library? That doesn't affect initial stack limits, right?
> >
> > Just to be clear, I am trying to import values 0 .. 16#FFFFF#, way beyond the two byte limit that so many libraries are functionally bound by in one bottle neck or another. I want to support something similar to 'kmscon', but with some shortcuts since I don't want to redo everything that others have done well. I just want to finish my library to a point of usefulness and focus on other projects. I felt compelled to create this library because every other library I looked at was broken in some way and even the most common font systems fail to support Unicode's full character range, making much of it useless. I figured I could create the exact effects that I am trying to with Unifont both in graphical windows of various OSs, and on the Linux terminal if I rewrite enough of the low level code that I don't have to rely on the less complete existing libraries. Admittedly, I have too little time to work on it, and am so far behind other people wonderful work that I will certainly have many holes and omitted functionality that should eventually be added later. My goal is to both make my programming projects possible and free certain features from too restricted licensing.
> I don't have the answer to your question.
>
> However, I'll think twice before writing my own Unicode implementation.
> It is way harder than you think. Managing all code points (0 ..
> 16#FFFFF#) is not enough.
> You can read more here : https://mcilloni.ovh/2023/07/23/unicode-is-hard/
Thank you, you are quite right. I have no intention of correctly handling Unicode for now. Just interpreting a few things, like combinations that overlay one sort of glyph onto another, and correctly handling Unifont's duospace variations for the immediate future. I know I am doing things the hard way, but I looked into the easier ways and couldn't find anything I could use. My attempt is tightly focused on Unifont, so a lot of vector, baseline, aspect, sub-pixel rendering, etc. means nothing to what I am attempting. I have instead of a terminal that uses Unifont as a font, a partial rendering library that plots characters and Unicode sequences in such a way that any number of non-printing characters can be sequenced in front of one or more printing glyphs, all without changing the line and index. Only the Alpha channel is rendered until the final rendering on the text area canvas (which is purely image graphics since all the rendering is internal). Along with this is a custom system of input that allows non-standard key combinations so that AE, OE, (c), etc. can be input as their actual characters instead of having to be copied and pasted from a character search tool or a fancy text input converter (like macOS with specific programs or word processors). I don't know why such developments have gone stale, but input support seems to be halted, per language, at the minimum operable level of development. This is one of the reasons I love Apple computers - They tend to go a little beyond the minimum. I am hoping I can rely on a GL library and probably the ICU library at some point. I have yet to see. Anyway, my library already has the beginning of limited support for text direction and flow that can print in any reasonable direction to accommodate various languages or block-character-graphics and a way to interpret where click/touch input maps to within the rendered text. It even has the beginning of a spread-sheet like separation of text areas, allowing a cursor or a scrolled view to be handled as expected or better when switching focus between cells. It is a long way from finished, but when combined with my other components, like object-oriented support for encoding and streaming, I feel it is getting closer to an eCS or OS/2 workplace shell in quality of handling programmed objects. The more that is handled well at the low level, the less work has to be complicated at the higher level. GUIs are a real problem for me because they are so sophisticated and automated that I can barely even attempt my own projects or a code base that transfers between graphical, terminal and other operating systems. GTK, GL libraries, and SDL are great and I plan to use at least one of them, but only to render the image buffer and collect input from modern hotplug-able devices. If I can get around to it I might try to support pseudo virtual terminals like GNU Screen does, but just managing application spawns with all their input/output being configurable is likely enough for me right now.
On Sunday, August 13, 2023 at 3:40:03 AM UTC-7, Simon Wright wrote:
> Jerry writes:
>
> > Does GNAT such as Simon's GCC 13.1.0 for macOS aarch64 allow parallel
> > loops and blocks?
> No, sorry, that's one of the advanced features that AdaCore aren't
> working on yet.
>
> https://blog.adacore.com/ada-202x-support-in-gnat
Thanks, Simon. I saw that blog post but since it's nearly three years old, I was hopeful. My O(N^4) radar simulations will have to remain slow. :-(
Le 13/08/2023 à 18:16, Micah Waddoups a écrit : > I tried to compile the Unifont hex file, converted with a script into variable Ada code, but it went on forever, gradually blowing up my memory. I used an .ads file and aimed for a static build, but I suspect I would have hit the stack size limit for executables if I succeeded > > My request for insight is: > (A) How do you recommend I compile the Unifont into a form that is usable within my Ada program. (I am thinking compiling C and importing, since C is so basic it might just work, but even better would be Assembly and I don't know how to import a large data variable compiled in Assembly or if I can even compile that much data using Assembly... It should work, but the compiler might complain and I still have to figure out the importing part.) > > (B) Do you think this has a chance of succeeding if I compile the font as a shared library? That doesn't affect initial stack limits, right? > > Just to be clear, I am trying to import values 0 .. 16#FFFFF#, way beyond the two byte limit that so many libraries are functionally bound by in one bottle neck or another. I want to support something similar to 'kmscon', but with some shortcuts since I don't want to redo everything that others have done well. I just want to finish my library to a point of usefulness and focus on other projects. I felt compelled to create this library because every other library I looked at was broken in some way and even the most common font systems fail to support Unicode's full character range, making much of it useless. I figured I could create the exact effects that I am trying to with Unifont both in graphical windows of various OSs, and on the Linux terminal if I rewrite enough of the low level code that I don't have to rely on the less complete existing libraries. Admittedly, I have too little time to work on it, and am so far behind other people wonderful work that I will certainly have many holes and omitted functionality that should eventually be added later. My goal is to both make my programming projects possible and free certain features from too restricted licensing. I don't have the answer to your question. However, I'll think twice before writing my own Unicode implementation. It is way harder than you think. Managing all code points (0 .. 16#FFFFF#) is not enough. You can read more here : https://mcilloni.ovh/2023/07/23/unicode-is-hard/
I tried to compile the Unifont hex file, converted with a script into variable Ada code, but it went on forever, gradually blowing up my memory. I used an .ads file and aimed for a static build, but I suspect I would have hit the stack size limit for executables if I succeeded My request for insight is: (A) How do you recommend I compile the Unifont into a form that is usable within my Ada program. (I am thinking compiling C and importing, since C is so basic it might just work, but even better would be Assembly and I don't know how to import a large data variable compiled in Assembly or if I can even compile that much data using Assembly... It should work, but the compiler might complain and I still have to figure out the importing part.) (B) Do you think this has a chance of succeeding if I compile the font as a shared library? That doesn't affect initial stack limits, right? Just to be clear, I am trying to import values 0 .. 16#FFFFF#, way beyond the two byte limit that so many libraries are functionally bound by in one bottle neck or another. I want to support something similar to 'kmscon', but with some shortcuts since I don't want to redo everything that others have done well. I just want to finish my library to a point of usefulness and focus on other projects. I felt compelled to create this library because every other library I looked at was broken in some way and even the most common font systems fail to support Unicode's full character range, making much of it useless. I figured I could create the exact effects that I am trying to with Unifont both in graphical windows of various OSs, and on the Linux terminal if I rewrite enough of the low level code that I don't have to rely on the less complete existing libraries. Admittedly, I have too little time to work on it, and am so far behind other people wonderful work that I will certainly have many holes and omitted functionality that should eventually be added later. My goal is to both make my programming projects possible and free certain features from too restricted licensing.
On 2023-08-13 12:39, Simon Wright wrote:
> Jerry <list_email@icloud.com> writes:
>
>> Does GNAT such as Simon's GCC 13.1.0 for macOS aarch64 allow parallel
>> loops and blocks?
>
> No, sorry, that's one of the advanced features that AdaCore aren't
> working on yet.
>
> https://blog.adacore.com/ada-202x-support-in-gnat
ISO/IEC 8652:2023 is the first Ada standard to be approved without a working
implementation. Probably a bad sign.
--
Jeff Carter
"If a sperm is wasted, God gets quite irate."
Monty Python's the Meaning of Life
56
Jerry <list_email@icloud.com> writes: > Does GNAT such as Simon's GCC 13.1.0 for macOS aarch64 allow parallel > loops and blocks? No, sorry, that's one of the advanced features that AdaCore aren't working on yet. https://blog.adacore.com/ada-202x-support-in-gnat
Does GNAT such as Simon's GCC 13.1.0 for macOS aarch64 allow parallel loops and blocks? Jerry
Hi all. I’ve created a NEORV32 target platform in SweetAda (https://github.com/gabriele-galeotti). NEORV32 (https://github.com/stnolting/neorv32) is a popular RISC-V SoC implementation in VHDL, suited for FPGAs. The setup so far is blatantly primitive and runs under simulation by means of GHDL, outputting a welcome message inside the simulated UART console and continuously output the value of the mtime timer. So far I have no FPGA hardware (besides the time) ready to create a real implementation, so if someone is using NEORV32 on real hardware, and is willing to test, it will be very interesting to know about a OK/KO flag feedback. The current setup needs only UART clocking parameters in the CTRL register, which I suppose it depends on the actual clock configuration. In the meantime I will continue to develop things inside the simulated GHDL environment. Best regards, G
Hello, I am attempting to build Matreshska (https://github.com/reznikmm/ matreshka_archive) with gnat-12.2.0 20220819 on FreeBSD-14-amd64, however the compilation fails with: [...] matreshka-internals-unicode-ucd-colls.ads:72265:27: warning: there are no others [-gnatwr] matreshka-internals-unicode-ucd-colls.ads:72781:27: warning: there are no others [-gnatwr] matreshka-internals-unicode-ucd-colls.ads:73297:27: warning: there are no others [-gnatwr] matreshka-internals-unicode-ucd-colls.ads:73911:27: warning: there are no others [-gnatwr] matreshka-internals-unicode-ucd-colls.ads:74427:27: warning: there are no others [-gnatwr] matreshka-internals-unicode-ucd-colls.ads:84101:09: error: violation of restriction "No_Elaboration_Code" at line 45 gprbuild: *** compilation phase failed gmake[3]: *** [Makefile.build:65: league] Error 4 Any advice? I am new to both Ada and Matreshka. I am also not sure if I am using the correct upstream source for Matreshka. forge.ada-ru.org/ matreshka is offline, landgraf's GitHub project is behind reznikmm read- only archive. -- To health and anarchy
Hi Simon; > > sed: illegal option -- s > > usage: sed script [-Ealnru] [-i extension] [file ...] > > sed [-Ealnu] [-i extension] [-e script] ... [-f script_file] ... [file ...] > This dosn't seem to do any harm. > See this PR: https://github.com/AdaCore/aws/pull/368 Cool. > > gnatcoll-refcount.ads:90:04: warnings > This set of warnings has been there for quite a while. I've never had a > problem with it. Also cool. > > Lots of "Exploring..." > I don't recall those messages ... I probably wasn't looking, so if the > build didn't stop I wouldn't have noticed Very good, see no problem then there is no problem :-) > > Lots of "Building"... If it doesn't complain then there's nothing > > missing and nothing wrong with the C and Ada sources? > I'd say Yes Very good, see no problem then there is no problem :-) > > The process generates at least three times a warning something like > > the following: "Generating possibly incomplete environment because of > > missing dependencies" > That's because the alr you're using doesn't understand MacPorts. Watch > this space. Looking forward to this! [GRIN*] > > What do I do now to ascertain the precise state of the alr aws package? > You could try > > cd demos/hello_world > alr exec -- make TARGET=aarch64-apple-darwin21 > ./hello_world > > and within 60 seconds open your browser on localhost:8080. > > (the 'make' part rebuilds the whole of aws!!) The test you suggested worked! Thank you! Ken
Kenneth Wolcott <kennethwolcott@gmail.com> writes: > ONE: > sed issues (three instances): > > sed: illegal option -- s > usage: sed script [-Ealnru] [-i extension] [file ...] > sed [-Ealnu] [-i extension] [-e script] ... [-f script_file] ... [file ...] This dosn't seem to do any harm. See this PR: https://github.com/AdaCore/aws/pull/368 > TWO: > gnatcoll-refcount.ads:90:04: warning: in instantiation at gnatcoll-storage_pools-headers.adb:57 [enabled by default] > gnatcoll-refcount.ads:90:04: warning: possible aliasing problem for type "Header_Access" [enabled by default] > gnatcoll-refcount.ads:90:04: warning: use -fno-strict-aliasing switch for references [enabled by default] > gnatcoll-refcount.ads:90:04: warning: or use "pragma No_Strict_Aliasing (Header_Access);" [enabled by default] This set of warnings has been there for quite a while. I've never had a problem with it. > Lots of "Exploring..." would there be something useful here as far as > something not pertinent being examined or something that was NOT > explored that should have been? I don't recall those messages ... I probably wasn't looking, so if the build didn't stop I wouldn't have noticed > Lots of "Building"...If it doesn't complain then there's nothing > missing and nothing wrong with the C and Ada sources? I'd say Yes > The process generates at least three times a warning something like > the following: "Generating possibly incomplete environment because of > missing dependencies" That's because the alr you're using doesn't understand MacPorts. Watch this space. > What do I do now to ascertain the precise state of the alr aws package? You could try cd demos/hello_world alr exec -- make TARGET=aarch64-apple-darwin21 ./hello_world and within 60 seconds open your browser on localhost:8080. (the 'make' part rebuilds the whole of aws!!)
Hi Simon; Vast improvement after changing the PATH env var as you instructed! I have an edited get+build log (hope it is not too long). Looks like there are still some sed issues and other things I'm not sure about. I guess it is too long; well it is definitely too annoying to copy&paste a screenfull at a time... What I saw: ONE: sed issues (three instances): sed: illegal option -- s usage: sed script [-Ealnru] [-i extension] [file ...] sed [-Ealnu] [-i extension] [-e script] ... [-f script_file] ... [file ...] TWO: gnatcoll-refcount.ads:90:04: warning: in instantiation at gnatcoll-storage_pools-headers.adb:57 [enabled by default] gnatcoll-refcount.ads:90:04: warning: possible aliasing problem for type "Header_Access" [enabled by default] gnatcoll-refcount.ads:90:04: warning: use -fno-strict-aliasing switch for references [enabled by default] gnatcoll-refcount.ads:90:04: warning: or use "pragma No_Strict_Aliasing (Header_Access);" [enabled by default] Lots of "Exploring..." would there be something useful here as far as something not pertinent being examined or something that was NOT explored that should have been? Lots of "Building"...If it doesn't complain then there's nothing missing and nothing wrong with the C and Ada sources? The process generates at least three times a warning something like the following: "Generating possibly incomplete environment because of missing dependencies" What do I do now to ascertain the precise state of the alr aws package? Thanks, Ken
Simon Wright <simon@pushface.org> writes:
> The reason, I think, is that you have /usr/bin in your PATH before
> /opt/gcc-13.1.0-aarch64.
/opt/gcc-13.1.0-aarch64/bin
^^^^
Kenneth Wolcott <kennethwolcott@gmail.com> writes: > make[1]: *** [../.build/arm64-apple-darwin22.6.0/debug/../setup/src/aws-os_lib.ads] Error 1 > make: *** [config_setup] Error 2 The reason, I think, is that you have /usr/bin in your PATH before /opt/gcc-13.1.0-aarch64. From the release notes at https://github.com/simonjwright/distributing-gcc/releases/tag/gcc-13.1.0-aarch64-2, Setting PATH PATH needs to be set to include /opt/gcc-13.1.0-aarch64/bin at the front: bash Insert export PATH=/opt/gcc-13.1.0-aarch64/bin:$PATH in your ~/.bash_profile_common. zsh Likewise, but in ~/.zshrc. /usr/bin/gcc is the exact same compiler as /usr/bin/clang (a hard link, by the look of it). $ /usr/bin/gcc -v Apple clang version 14.0.3 (clang-1403.0.22.14.1) Target: arm64-apple-darwin22.5.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin $ /opt/gcc-13.1.0-aarch64/bin/gcc -v Using built-in specs. COLLECT_GCC=/opt/gcc-13.1.0-aarch64/bin/gcc COLLECT_LTO_WRAPPER=/opt/gcc-13.1.0-aarch64/libexec/gcc/aarch64-apple-darwin21/13.1.0/lto-wrapper Target: aarch64-apple-darwin21 Configured with: [...] Thread model: posix Supported LTO compression algorithms: zlib gcc version 13.1.0 (GCC) I think you need to fix the PATH problem, then build with $ alr build -- -XTARGET=aarch64-apple-darwin21
Hi Simon; An attempt to "get" aws follows along with all of my openssl installed packages from MacPorts. alr --no-color get aws Warning: Warning: New solution is incomplete. Warning: +i gnat 13.1.0 (new,installed,gnat_external) Warning: + gnatcoll 23.0.0 (new) Warning: + libgpr 23.0.0 (new,indirect) Warning: + make 3.81.0 (new) Warning: +~ openssl * (new,external) Warning: + xmlada 23.0.0 (new) Warning: Warning: Could not find a complete solution for aws=23.0.0 Build will fail unless externals are made available, do you want to continue? [Y] Yes [N] No (default is No) y Note: Deploying aws=23.0.0... ########################################################################################################################### 100.0% warn: Generating possibly incomplete environment because of missing dependencies Note: Deploying make=3.81.0... Note: Deploying xmlada=23.0.0... -=O#- # # # Note: Running post_fetch actions for xmlada=23.0.0... checking build system type... aarch64-apple-darwin22.6.0 checking host system type... aarch64-apple-darwin22.6.0 checking target system type... aarch64-apple-darwin22.6.0 checking whether gnat can build shared libs... yes checking for a BSD-compatible install... /opt/local/bin/ginstall -c checking whether ln -s works... yes configure: creating ./config.status config.status: creating xmlada_shared.gpr config.status: creating Makefile config.status: creating tests/dom/default.gpr Note: Deploying libgpr=23.0.0... -=O#- # # # Note: Deploying gnatcoll=23.0.0... -=#=- # # # Note: Running post_fetch actions for aws=23.0.0... sed: illegal option -- s usage: sed script [-Ealnru] [-i extension] [file ...] sed [-Ealnu] [-i extension] [-e script] ... [-f script_file] ... [file ...] sed: illegal option -- s usage: sed script [-Ealnru] [-i extension] [file ...] sed [-Ealnu] [-i extension] [-e script] ... [-f script_file] ... [file ...] Bind [gprbind] xoscons.bexch [Ada] xoscons.ali Link [link] xoscons.adb Setup OS specific definitions aws-os_lib-tmplt.c:324:24: error: invalid operand for inline asm constraint 'i' /*NOGEN*/ asm volatile("\n->CND:%0:" "SIN_FAMILY_OFFSET" ":%1:" "sin_family offset in record" : : "i" (324), "i" ((int) (uintptr_t)((uintptr_t)&sa.sin_family - (uintptr_t)&sa)));; ^ aws-os_lib-tmplt.c:343:24: error: invalid operand for inline asm constraint 'i' /*NOGEN*/ asm volatile("\n->CND:%0:" "AI_FAMILY_OFFSET" ":%1:" "???" : : "i" (343), "i" ((int) (uintptr_t)((uintptr_t)&ai.ai_family - (uintptr_t)&ai)));; ^ aws-os_lib-tmplt.c:344:24: error: invalid operand for inline asm constraint 'i' /*NOGEN*/ asm volatile("\n->CND:%0:" "AI_CANONNAME_OFFSET" ":%1:" "???" : : "i" (344), "i" ((int) (uintptr_t)((uintptr_t)&ai.ai_canonname - (uintptr_t)&ai)));; ^ aws-os_lib-tmplt.c:345:24: error: invalid operand for inline asm constraint 'i' /*NOGEN*/ asm volatile("\n->CND:%0:" "AI_ADDR_OFFSET" ":%1:" "???" : : "i" (345), "i" ((int) (uintptr_t)((uintptr_t)&ai.ai_addr - (uintptr_t)&ai)));; ^ aws-os_lib-tmplt.c:233:17: error: unexpected token at start of statement asm volatile("\n->TXT:%0:" "-- This is the version for " "arm64-apple-darwin22.6.0" : : "i" (233)); ^ <inline asm>:2:1: note: instantiated into assembly here ->TXT:233:-- This is the version for arm64-apple-darwin22.6.0 ^ aws-os_lib-tmplt.c:234:17: error: unexpected token at start of statement asm volatile("\n->TXT:%0:" "" : : "i" (234)); ^ <inline asm>:2:1: note: instantiated into assembly here ->TXT:234: ^ aws-os_lib-tmplt.c:240:17: error: unexpected token at start of statement asm volatile("\n->TXT:%0:" "with Interfaces.C.Strings;" : : "i" (240)); ^ <inline asm>:2:1: note: instantiated into assembly here ->TXT:240:with Interfaces.C.Strings; ^ aws-os_lib-tmplt.c:241:17: error: unexpected token at start of statement asm volatile("\n->TXT:%0:" "with System;" : : "i" (241)); ^ <inline asm>:2:1: note: instantiated into assembly here ->TXT:241:with System; ^ aws-os_lib-tmplt.c:243:17: error: unexpected token at start of statement asm volatile("\n->TXT:%0:" "with GNAT.OS_Lib;" : : "i" (243)); ^ <inline asm>:2:1: note: instantiated into assembly here ->TXT:243:with GNAT.OS_Lib; ^ aws-os_lib-tmplt.c:272:17: error: unexpected token at start of statement asm volatile("\n->C:%0:" "Target_OS" ":" "OS_Type" ":" "Other_OS" ":" "" : : "i" (272)); ^ <inline asm>:2:1: note: instantiated into assembly here ->C:272:Target_OS:OS_Type:Other_OS: ^ aws-os_lib-tmplt.c:281:17: error: unexpected token at start of statement asm volatile("\n->C:%0:" "Target_Name" ":" "String" ":" "arm64-apple-darwin22.6.0" ":" "" : : "i" (281)); ^ <inline asm>:2:1: note: instantiated into assembly here ->C:281:Target_Name:String:arm64-apple-darwin22.6.0: ^ aws-os_lib-tmplt.c:310:17: error: unexpected token at start of statement asm volatile("\n->CND:%0:" "SIZEOF_unsigned_int" ":%1:" "Size of unsigned int" : : "i" (310), "i" ((int) sizeof (unsigned int))); ^ <inline asm>:2:1: note: instantiated into assembly here ->CND:310:SIZEOF_unsigned_int:4:Size of unsigned int ^ aws-os_lib-tmplt.c:313:17: error: unexpected token at start of statement asm volatile("\n->CND:%0:" "SIZEOF_fd_set" ":%1:" "fd_set" : : "i" (313), "i" ((int) (sizeof (fd_set))));; ^ <inline asm>:2:1: note: instantiated into assembly here ->CND:313:SIZEOF_fd_set:128:fd_set ^ aws-os_lib-tmplt.c:314:17: error: unexpected token at start of statement asm volatile("\n->CND:%0:" "FD_SETSIZE" ":%1:" "Max fd value" : : "i" (314), "i" ((int) 1024));; ^ <inline asm>:2:1: note: instantiated into assembly here ->CND:314:FD_SETSIZE:1024:Max fd value ^ aws-os_lib-tmplt.c:320:17: error: unexpected token at start of statement asm volatile("\n->CND:%0:" "SIZEOF_sin_family" ":%1:" "Size of sa.sin_family" : : "i" (320), "i" ((int) sizeof (sa.sin_family) * 8));; ^ <inline asm>:2:1: note: instantiated into assembly here ->CND:320:SIZEOF_sin_family:8:Size of sa.sin_family ^ aws-os_lib-tmplt.c:353:17: error: unexpected token at start of statement asm volatile("\n->CND:%0:" "SIZEOF_nfds_t" ":%1:" "Size of nfds_t" : : "i" (353), "i" ((int) sizeof (nfds_t) * 8));; ^ <inline asm>:2:1: note: instantiated into assembly here ->CND:353:SIZEOF_nfds_t:32:Size of nfds_t ^ aws-os_lib-tmplt.c:362:17: error: unexpected token at start of statement asm volatile("\n->CND:%0:" "SIZEOF_pollfd_events" ":%1:" "Size of pollfd.events" : : "i" (362), "i" ((int) sizeof (v_pollfd.events) * 8));; ^ <inline asm>:2:1: note: instantiated into assembly here ->CND:362:SIZEOF_pollfd_events:16:Size of pollfd.events ^ aws-os_lib-tmplt.c:373:17: error: unexpected token at start of statement asm volatile("\n->CND:%0:" "SIZEOF_fd_type" ":%1:" "Size of socket fd" : : "i" (373), "i" ((int) sizeof (v_pollfd.fd) * 8));; ^ <inline asm>:2:1: note: instantiated into assembly here ->CND:373:SIZEOF_fd_type:32:Size of socket fd ^ aws-os_lib-tmplt.c:381:17: error: unexpected token at start of statement asm volatile("\n->CND:%0:" "SIZEOF_socklen_t" ":%1:" "Size of socklen_t" : : "i" (381), "i" ((int) sizeof (socklen_t) * 8));; ^ <inline asm>:2:1: note: instantiated into assembly here ->CND:381:SIZEOF_socklen_t:32:Size of socklen_t ^ fatal error: too many errors emitted, stopping now [-ferror-limit=] 20 errors generated. raised raised ADA.IO_EXCEPTIONS.NAME_ERROR : aws-os_lib-tmplt.s: No such file or directory make[1]: *** [../.build/arm64-apple-darwin22.6.0/debug/../setup/src/aws-os_lib.ads] Error 1 make: *** [config_setup] Error 2 ERROR: A post-fetch action failed, re-run with -vv -d for details ----------------------------------------------- port installed | grep openssl openssl @3_8 openssl @3_9 openssl @3_9+universal openssl @3_10+universal openssl @3_10 openssl @3_11 openssl @3_12 (active) openssl3 @3.0.7_0+legacy openssl3 @3.0.7_2+legacy openssl3 @3.0.8_1+legacy openssl3 @3.0.8_1+legacy+universal openssl3 @3.1.0_0+universal openssl3 @3.1.0_1 openssl3 @3.1.0_1+universal openssl3 @3.1.0_2+universal openssl3 @3.1.0_3+universal openssl3 @3.1.0_3 openssl3 @3.1.1_0 openssl3 @3.1.2_0 (active) openssl10 @1.0.2u_4 (active) openssl11 @1.1.1s_0 openssl11 @1.1.1t_0 openssl11 @1.1.1t_1 openssl11 @1.1.1u_1 openssl11 @1.1.1v_1 (active) py310-openssl @21.0.0_0 py310-openssl @22.1.0_0 py310-openssl @23.0.0_0 py310-openssl @23.2.0_0 (active) py311-openssl @23.0.0_0 py311-openssl @23.2.0_0 (active) qt5-qtbase @5.15.6_1+openssl qt5-qtbase @5.15.8_0+openssl qt5-qtbase @5.15.8_1+openssl qt5-qtbase @5.15.9_0+openssl qt5-qtbase @5.15.10_0+openssl (active) qt6-qtbase @6.4.3_1+openssl (active) ----------------------------------------------- That reminds me, I need to uninstall those "universal" packages... Thanks, Ken
On Sunday, August 6, 2023 at 4:30:16 AM UTC-7, Simon Wright wrote: > Kenneth Wolcott writes: > > So please show me what to do that will result in further progress with > > ALR and an M1 chip without using homebrew... > No guarantees here, but .. Again, sorry I was lazy and did not trim details not relevant to the current response in the thread... You asked which version of alr I was using: alr --version alr 2.0-dev > If alr says that a particular external package isn't available, then > > * instead of saying N say Y and install the requested package using port > > * set these environment variables: > export C_INCLUDE_PATH=/opt/local/include > export CPLUS_INCLUDE_PATH=/opt/local/include > export LIBRARY_PATH=/opt/local/lib Ok, I set those environment variables and now I will try "get"ing a package, responding "Y" if the package is incomplete and if there does seem to be a corresponding MacPorts port which I have not installed, will install it. Again, referring to your prior response: gcc -dumpmachine arm64-apple-darwin22.6.0 Thanks, Ken
On Sunday, August 6, 2023 at 4:58:18 PM UTC-5, Simon Wright wrote:
> [build-switches]
> "*".ada_version = "ada2022"
>
> or
>
> [build-switches]
> "*".ada_version = ["-gnat2022"]
>
> See "Release Information" (near the end) and "Build Profiles and
> Switches" in the documentation.
I see now, I think using "*".ada_version = "ada2022" is better for this case
Seth Workman <saworkman1@gmail.com> writes: > I have only started learning about Ada recently and have discovered > the 'Image attribute that can be used on all types starting in ada > 2022. > > I am using Alire and added the following to include the `-gnat2022` switch. > ``` > for Default_Switches ("Ada") use Learning_Config.Ada_Compiler_Switches & ("-gnat2022"); > ``` > > The Alire documentation warns about switches ~"In general, this should > be avoided to preserve consistency in the ecosystem" Not 100% sure what this means! > Is this the correct way about adding this switch or is there a way to > use a toolchain that already has it by default? This works fine, but in your alire.toml you could say [build-switches] "*".ada_version = "ada2022" or [build-switches] "*".ada_version = ["-gnat2022"] See "Release Information" (near the end) and "Build Profiles and Switches" in the documentation.
I have only started learning about Ada recently and have discovered the 'Image attribute that can be used on all types starting in ada 2022. I am using Alire and added the following to include the `-gnat2022` switch. ``` for Default_Switches ("Ada") use Learning_Config.Ada_Compiler_Switches & ("-gnat2022"); ``` The Alire documentation warns about switches ~"In general, this should be avoided to preserve consistency in the ecosystem" Is this the correct way about adding this switch or is there a way to use a toolchain that already has it by default?
Kenneth Wolcott <kennethwolcott@gmail.com> writes:
> If I don't install homebrew then what is it that I need to do to
> achieve the objective? I'd like to use ALR, but it looks like it only
> works for packages that are pure Ada (I'm not 100% sure of that, but
> it seems to be the case).
>
> So please show me what to do that will result in further progress with
> ALR and an M1 chip without using homebrew...
No guarantees here, but ..
If alr says that a particular external package isn't available, then
* instead of saying N say Y and install the requested package using port
* set these environment variables:
export C_INCLUDE_PATH=/opt/local/include
export CPLUS_INCLUDE_PATH=/opt/local/include
export LIBRARY_PATH=/opt/local/lib
Kenneth Wolcott <kennethwolcott@gmail.com> writes: [About 70 lines of quoted comment. It'd help if you could leave in only the relevant parts of the message you're replying to.] > BTW, Simon, I am NOW using your ALR package. I am using the following > build I'm going to have to consider making releases in a way that makes it easier for me to identify which release you're using. > alr --no-color build -- -XTARGET=arm64-apple-darwin22.6.0 If this is when building aws, where there is an issue with TARGET, I'd recommend setting TARGET to what you get by executing "gcc -dumpmachine", which I believe should be "aarch64-apple-darwin21". The problem is that aws's alire.toml sets TARGET to a value different from that needed by the actual code. > I was able to "alr get" and successfully build only eight of the alr > packages that I was interested in. Sorry, what I'm interested in at the meoment is the ones that *didn't* work because they tried to use an external that isn't set up yet; something like $ alr with libreadline ⓘ Synchronizing workspace... Nothing to update. Requested changes: ✓ libreadline * (add) Changes to dependency solution: New solution is incomplete. +🔎 libreadline * (new,external) <============ Do you want to proceed? [Y] Yes [N] No (default is No) > It seems clear that MacPorts and homebrew are not compatible > (especially if building packages using either or both of them). I think you could probably install both for getting tools (eg graphviz), but to install libraries for building software against you have to decide which one to go for. My latest version of alr (not yet released, issue with Github CI) checks whether "brew" or "port" are on the PATH; if it finds both, it chooses Homebrew. > BTW: mathpaqs failed to build due to "digits value out of range, > maximum is 15". This is because GNAT on x86_64 implements Long_Long_Float as 128 bits, 'digits 18', whereas GNAT on aarch64 only goes up to 64 bits, 'digits 15'.
On Saturday, August 5, 2023 at 3:12:48 PM UTC-7, Simon Wright wrote:
> Kenneth Wolcott writes:
>
> > So I guess it is fair to say that ALR depends on homebrew and ALR
> > will not work at all if there is a dependency on some C headers or
> > libraries that can only be provided by homebrew?
> Sorry, but I've no idea how you got there from what I said!
Ok, perhaps that was a wee-bit severe, but it sure does look like that is the case.
What else am I to do?
If I don't install homebrew then what is it that I need to do to achieve the objective? I'd like to use ALR, but it looks like it only works for packages that are pure Ada (I'm not 100% sure of that, but it seems to be the case).
So please show me what to do that will result in further progress with ALR and an M1 chip without using homebrew...
Also, I'm still learning how to use gprbuild, so I really don't understand how to proceed with the hand-patching of the sdlada porting to MacPorts issue (different thread).
Thanks,
Ken
Kenneth Wolcott <kennethwolcott@gmail.com> writes:
> So I guess it is fair to say that ALR depends on homebrew and ALR
> will not work at all if there is a dependency on some C headers or
> libraries that can only be provided by homebrew?
Sorry, but I've no idea how you got there from what I said!
On Saturday, August 5, 2023 at 2:02:27 PM UTC-7, Kenneth Wolcott wrote:
> On Saturday, August 5, 2023 at 12:28:59 AM UTC-7, Simon Wright wrote:
> > Kenneth Wolcott writes:
> >
> > > I am on a Mac Mini with an M1 chip and I have GNAT Ada 13.1 (thanks Simon!)
> > I take it you're using the aarch64 (Apple silicon) version?
> > > ALR does not work very well for me. I am unable to "alr get" many
> > > packages (see below for an example).
> > Please let me know which (external) packages you're having trouble with.
> > > Updating the index does not help in most of these cases.
> > >
> > > Is ALR incompatible with an external GNAT compiler?
> > No.
> >
> > Which version of alr are you using? If it's 2.0-dev (from my build, see
> > below, for Apple silicon) then it understands Homebrew.
> >
> > https://github.com/simonjwright/alire-index.mac/releases/tag/alr_binary_aarch64-1.0.0
> >
> > Not all index entries for external packages have been updated to include
> > Homebrew links (this includes openssl), but you should still be able to
> > say "brew install <whatever>" and have it work.
> >
> > At present, you need to have something like this in your startup
> > scripts: working on it!
> >
> > eval $(/opt/homebrew/bin/brew shellenv)
> > export C_INCLUDE_PATH=$HOMEBREW_PREFIX/include
> > export LIBRARY_PATH=$HOMEBREW_PREFIX/lib
> > > What am I doing wrong here?
> > Running past the wavefront :-(
> >
> > > alr --no-color get aws
> >
> > It took me a while to work out that I needed to use
> > --no-color. Investigating what's going wrong.
> > > Warning:
> > > Warning: New solution is incomplete.
> > > Warning: +i gnat 13.1.0 (new,installed,gnat_external)
> > > Warning: + gnatcoll 23.0.0 (new)
> > > Warning: + libgpr 23.0.0 (new,indirect)
> > > Warning: + make 3.81.0 (new)
> > > Warning: +~ openssl * (new,external)
> > > Warning: + xmlada 23.0.0 (new)
> > > Warning:
> > > Warning: Could not find a complete solution for aws=23.0.0
> > > Build will fail unless externals are made available, do you want to continue?
> > > [Y] Yes [N] No (default is No) n
> > > ERROR: Crate retrieval abandoned.
> > If you "brew install openssl" you should be able to say "Y" here.
> >
> > I found there was an extra setting required:
> >
> > alr build -- -XTARGET=aarch64-apple-darwin21
> >
> > (find the correct setting by "gcc -v" and looking at the "Target:" line).
> Hi Simon;
>
> So I guess it is fair to say that ALR depends on homebrew and ALR will not work at all if there is a dependency on some C headers or libraries that can only be provided by homebrew?
>
> Thanks,
> Ken
BTW, Simon, I am NOW using your ALR package. I am using the following build
alr --no-color build -- -XTARGET=arm64-apple-darwin22.6.0
I was able to "alr get" and successfully build only eight of the alr packages that I was interested in.
ansiada_1.0.0_dc770a5a
apdf_6.0.0_7c3ce4e9
aunit_23.0.0_84ce7d0b
euler_tools_1.1.1_cf37e6f9
gnatcoll_23.0.0_29478a20
parse_args_0.9.0_635f9e4f
stephes_ada_library_3.7.2_2b6a88f9
xmlada_23.0.0_70494123
Either the get failed or the compile failed. I'll assume that virtually all of those "get" failures are due to lack of a homebrew installation.
I have MANY MacPorts port packages installed which I like very much.
It seems clear that MacPorts and homebrew are not compatible (especially if building packages using either or both of them).
BTW: mathpaqs failed to build due to "digits value out of range, maximum is 15".
Thanks,
Ken
On Saturday, August 5, 2023 at 12:28:59 AM UTC-7, Simon Wright wrote:
> Kenneth Wolcott writes:
>
> > I am on a Mac Mini with an M1 chip and I have GNAT Ada 13.1 (thanks Simon!)
> I take it you're using the aarch64 (Apple silicon) version?
> > ALR does not work very well for me. I am unable to "alr get" many
> > packages (see below for an example).
> Please let me know which (external) packages you're having trouble with.
> > Updating the index does not help in most of these cases.
> >
> > Is ALR incompatible with an external GNAT compiler?
> No.
>
> Which version of alr are you using? If it's 2.0-dev (from my build, see
> below, for Apple silicon) then it understands Homebrew.
>
> https://github.com/simonjwright/alire-index.mac/releases/tag/alr_binary_aarch64-1.0.0
>
> Not all index entries for external packages have been updated to include
> Homebrew links (this includes openssl), but you should still be able to
> say "brew install <whatever>" and have it work.
>
> At present, you need to have something like this in your startup
> scripts: working on it!
>
> eval $(/opt/homebrew/bin/brew shellenv)
> export C_INCLUDE_PATH=$HOMEBREW_PREFIX/include
> export LIBRARY_PATH=$HOMEBREW_PREFIX/lib
> > What am I doing wrong here?
> Running past the wavefront :-(
>
> > alr --no-color get aws
>
> It took me a while to work out that I needed to use
> --no-color. Investigating what's going wrong.
> > Warning:
> > Warning: New solution is incomplete.
> > Warning: +i gnat 13.1.0 (new,installed,gnat_external)
> > Warning: + gnatcoll 23.0.0 (new)
> > Warning: + libgpr 23.0.0 (new,indirect)
> > Warning: + make 3.81.0 (new)
> > Warning: +~ openssl * (new,external)
> > Warning: + xmlada 23.0.0 (new)
> > Warning:
> > Warning: Could not find a complete solution for aws=23.0.0
> > Build will fail unless externals are made available, do you want to continue?
> > [Y] Yes [N] No (default is No) n
> > ERROR: Crate retrieval abandoned.
> If you "brew install openssl" you should be able to say "Y" here.
>
> I found there was an extra setting required:
>
> alr build -- -XTARGET=aarch64-apple-darwin21
>
> (find the correct setting by "gcc -v" and looking at the "Target:" line).
Hi Simon;
So I guess it is fair to say that ALR depends on homebrew and ALR will not work at all if there is a dependency on some C headers or libraries that can only be provided by homebrew?
Thanks,
Ken
Kenneth Wolcott <kennethwolcott@gmail.com> writes: > I am on a Mac Mini with an M1 chip and I have GNAT Ada 13.1 (thanks Simon!) I take it you're using the aarch64 (Apple silicon) version? > ALR does not work very well for me. I am unable to "alr get" many > packages (see below for an example). Please let me know which (external) packages you're having trouble with. > Updating the index does not help in most of these cases. > > Is ALR incompatible with an external GNAT compiler? No. Which version of alr are you using? If it's 2.0-dev (from my build, see below, for Apple silicon) then it understands Homebrew. https://github.com/simonjwright/alire-index.mac/releases/tag/alr_binary_aarch64-1.0.0 Not all index entries for external packages have been updated to include Homebrew links (this includes openssl), but you should still be able to say "brew install <whatever>" and have it work. At present, you need to have something like this in your startup scripts: working on it! eval $(/opt/homebrew/bin/brew shellenv) export C_INCLUDE_PATH=$HOMEBREW_PREFIX/include export LIBRARY_PATH=$HOMEBREW_PREFIX/lib > What am I doing wrong here? Running past the wavefront :-( > alr --no-color get aws It took me a while to work out that I needed to use --no-color. Investigating what's going wrong. > Warning: > Warning: New solution is incomplete. > Warning: +i gnat 13.1.0 (new,installed,gnat_external) > Warning: + gnatcoll 23.0.0 (new) > Warning: + libgpr 23.0.0 (new,indirect) > Warning: + make 3.81.0 (new) > Warning: +~ openssl * (new,external) > Warning: + xmlada 23.0.0 (new) > Warning: > Warning: Could not find a complete solution for aws=23.0.0 > Build will fail unless externals are made available, do you want to continue? > [Y] Yes [N] No (default is No) n > ERROR: Crate retrieval abandoned. If you "brew install openssl" you should be able to say "Y" here. I found there was an extra setting required: alr build -- -XTARGET=aarch64-apple-darwin21 (find the correct setting by "gcc -v" and looking at the "Target:" line).
Hi; I am on a Mac Mini with an M1 chip and I have GNAT Ada 13.1 (thanks Simon!) ALR does not work very well for me. I am unable to "alr get" many packages (see below for an example). Updating the index does not help in most of these cases. Is ALR incompatible with an external GNAT compiler? What am I doing wrong here? Thanks, Ken Wolcott alr --no-color get aws Warning: Warning: New solution is incomplete. Warning: +i gnat 13.1.0 (new,installed,gnat_external) Warning: + gnatcoll 23.0.0 (new) Warning: + libgpr 23.0.0 (new,indirect) Warning: + make 3.81.0 (new) Warning: +~ openssl * (new,external) Warning: + xmlada 23.0.0 (new) Warning: Warning: Could not find a complete solution for aws=23.0.0 Build will fail unless externals are made available, do you want to continue? [Y] Yes [N] No (default is No) n ERROR: Crate retrieval abandoned.
On the WolfSSL blog I saw the following announcement today: Today we are happy to announce the availability of an Ada/SPARK binding that enables Ada applications to use post-quantum TLS 1.3 encryption through the wolfSSL embedded SSL/TLS library. It opens the door to obtaining FIPS 140-3 and DO-178C certifications for Ada and Spark applications that use TLS for their encrypted communications and also makes them quantum-safe. Check out the Ada/SPARK binding on GitHub here: https://github.com/wolfSSL/wolfssl/tree/master/wrapper/Ada The Ada port is suitable for anything from IoT, embedded systems to Desktop and Cloud systems. Contact us at facts@wolfssl.com, or call us at +1 425 245 8247 with any questions, comments, or suggestions. URL to blog post: https://www.wolfssl.com/announcing-ada-binding-to-the-wolfssl-library/
On 08/06/2023 16:19, Luke A. Guest wrote:
>On 08/06/2023 04:55, Nasser M. Abbasi wrote:
>> Some folks in this thread
>>
>> https://discourse.julialang.org/t/comparison-of-rust-to-julia-for-scientific-computing/78508
>>
>> "I’m not an expert, but my feeling is that Rust is a “safer” language,
>> which to me means it must be slower."
>
Rust isn't a safer language. Rust is more targetted at the heap which is
slower than the stack. Additionally if you use Adas type system well then
you can remove input validation checks again making Ada faster. The
compiler is better and safer at optimising checks away.
--
Regards, Kc
>make it into a proper mailing list like most open source projects
>use.
PhoNews seems alright for Android but honestly setting up a server and
client isn't exactly conducive to onboarding.
Wouldn't a google group hosted account just work with an email address like
the pqc-forum group does?
--
Regards, Kc
> NNTP facilitates responses sent over
> SMTP or NNTP, whichever you wish.
I run a mail server and have set up mailing lists in the past.
Thanks, however, what I am asking for is whether there is or
can be an easy way for users to change the current system
from sending emails for threads that we are involved in to
sending emails for all messages? Obviously that wouldn't
make it into a proper mailing list like most open source projects
use.
Kevin Chadwick <kevc3no4@gmail.com> wrote: > Is there a decent mobile client for this usenet. There is (are). The self-describing header lines of posts identify some. > Or any way to get all > emails instead of just those that you are involved in? > NNTP facilitates responses sent over SMTP or NNTP, whichever you wish.
> > There are several web-oriented Ada discussion fora, for example > > https://forum.ada-lang.io, not to mention stackoverflow and reddit. > > > There are also several Ada rooms (Ada, Alire, Ada Drivers Library...) on > Matrix (https://matrix.org/). Yes , I also prefer mailing lists to web tech. Matrix threading seems to be quite poor. Is there a decent mobile client for this usenet. Or any way to get all emails instead of just those that you are involved in? On Telegram someone else chimed in with: > > > If anyone finds out how to change that setting, I will be so grateful. > > > I remember to check my email, I don't remember to check the > > > Google page > > > Google doesn't even offer an rss feed anymore
> There are several web-oriented Ada discussion fora, for example > https://forum.ada-lang.io, not to mention stackoverflow and reddit. > There are also several Ada rooms (Ada, Alire, Ada Drivers Library...) on Matrix (https://matrix.org/).
On 2023-08-01 16:29, Kevin Chadwick wrote: >> but I hope you know that >> comp.lang.ada is basically not a "google group", but a "USENET news" >> group that can be accessed via google, but is better accessed through a >> "news-reader" program (a USENET client). > > Thank you for responding. I didn't realise that. > That is unfortunate. Most mailing lists just work immediately with any email > client on any platform, including Android. The point is that comp.lang.ada is _not_ a mailing list. Different technology. If you want to know more about the tech, see https://en.wikipedia.org/wiki/Usenet. Some people (perhaps many people) think USENET is out of date, and indeed new discussion fora with a similar purpose are usually built on web technology. But I find that USENET offers a better user interface than all web fora I've ever experienced, even if limited to text only. There are several web-oriented Ada discussion fora, for example https://forum.ada-lang.io, not to mention stackoverflow and reddit.
> but I hope you know that
> comp.lang.ada is basically not a "google group", but a "USENET news"
> group that can be accessed via google, but is better accessed through a
> "news-reader" program (a USENET client).
Thank you for responding. I didn't realise that.
That is unfortunate. Most mailing lists just work immediately with any email
client on any platform, including Android.
On 2023-08-01 2:41, Kevin Chadwick wrote: > Normally for mailing lists and other google groups. > I have it set to receive every email which you can > then easily reply to. > That setting is greyed out for comp.lang.ada. > Why is that? I'm probably not the best person to answer you, but I hope you know that comp.lang.ada is basically not a "google group", but a "USENET news" group that can be accessed via google, but is better accessed through a "news-reader" program (a USENET client). Several e-mail programs, such as Thunderbird, include news-readers. When you read comp.lang.ada through a news-reader, it works very much like e-mail. > Can that restriction be lifted as I would much rather > use an email client? I don't know about the google interface to comp.lang.ada (I've never used it), so I can't answer. But if you would rather use an e-mail client, try to use its news-reader to access comp.lang.ada. You will need an account with a USENET service provider; there are both free (gratis) providers (https://www.eternal-september.org/ is often suggested) and providers that require small annual fees.
Those using SPARK may find this useful: https://github.com/jrcarter/SparkRC -- Jeffrey R. Carter, President PragmAda Software Engineering pragmada.x10hosting.com github.com/jrcarter
Normally for mailing lists and other google groups. I have it set to receive every email which you can then easily reply to. That setting is greyed out for comp.lang.ada. Why is that? Can that restriction be lifted as I would much rather use an email client? I believe this list would get a boost in users as a result and a more consistent 80 character width. Regards, Kevin Chadwick
On Saturday, July 29, 2023 at 9:43:42 PM UTC-7, Randy Brukardt wrote:
> 'Image doesn't support any formatting, so no "Aft" or "Exp". The slicing
> isn't the problem. :-)
>
> You can use Text_IO to write to a string if you need formatting. 'Image is
> for quick & dirty debugging, not fancy output. (Of course, if you're lucky
> and it does what you need, then feel free to use it.)
Hi Randy;
Thank you for your input.
I think I was (maybe I still am) suffering from the "sprintf" "disease" from Perl (and C).
Thanks,
Ken
On Mon, 31 Jul 2023 08:58:59 +0100, Simon Wright <simon@pushface.org>
declaimed the following:
>I don't know whether Windows defines "OS", but if it does you could just
>set Darwin (or whatever) as the default?
>
Window 10 Pro:
C:\Users\Owner>echo %os%
Windows_NT
C:\Users\Owner>
On Monday, July 31, 2023 at 3:59:04 AM UTC-4, Simon Wright wrote:
> "Rajagopalan Srinivasan 192/73" <rsrin...@alumni.iitm.ac.in> writes:
>
> > What is the way to specify platform dependent Linker options on a Mac?
> >
> > for linux I use something like the following in my gpr file:
> >
> > case os is
> >
> > when "GNU/Linux" =>
> >
> > not sure what is equivalent for the M1 Mac?
> What is "os" in the above? If it's the environment variable OS then,
> indeed, there's no equivalent on macOS (either kind of silicon).
>
> I don't know whether Windows defines "OS", but if it does you could just
> set Darwin (or whatever) as the default?
>
> OS := external ("OS", "Darwin");
>
> If you're using Alire, the generated config/{crate}_config.gpr contains
> on macOS
>
> Alire_Host_OS := "macOS";
Excellent suggestion. The following worked:
package Linker is
case audio_config.Alire_Host_OS is
when "macos" =>
for Switches("Ada") use ("-L/opt/homebrew/lib/", "-lsndfile");
when others =>
for Switches("Ada") use ("-lsndfile");
end case;
end Linker;
"Rajagopalan Srinivasan 192/73" <rsrinivasan@alumni.iitm.ac.in> writes:
> What is the way to specify platform dependent Linker options on a Mac?
>
> for linux I use something like the following in my gpr file:
>
> case os is
>
> when "GNU/Linux" =>
>
> not sure what is equivalent for the M1 Mac?
What is "os" in the above? If it's the environment variable OS then,
indeed, there's no equivalent on macOS (either kind of silicon).
I don't know whether Windows defines "OS", but if it does you could just
set Darwin (or whatever) as the default?
OS := external ("OS", "Darwin");
If you're using Alire, the generated config/{crate}_config.gpr contains
on macOS
Alire_Host_OS := "macos";
What is the way to specify platform dependent Linker options on a Mac? for linux I use something like the following in my gpr file: case os is when "GNU/Linux" => not sure what is equivalent for the M1 Mac? thanks, Srini
'Image doesn't support any formatting, so no "Aft" or "Exp". The slicing
isn't the problem. :-)
You can use Text_IO to write to a string if you need formatting. 'Image is
for quick & dirty debugging, not fancy output. (Of course, if you're lucky
and it does what you need, then feel free to use it.)
Randy.
"Kenneth Wolcott" <kennethwolcott@gmail.com> wrote in message
news:2a5702b3-dbbc-4255-a4d4-e801f227fed3n@googlegroups.com...
On Saturday, July 29, 2023 at 4:49:08?PM UTC-7, Kenneth Wolcott wrote:
> On Saturday, July 29, 2023 at 4:07:17?AM UTC-7, AdaMagica wrote:
> > > Powers_of_2 := Powers_of_2 * To_Big_Integer (2);
> > With the aspect Integer_Literal, also Powers_of_2 * 2 must work. The
> > attributes Integer_Literal, Real_Literal, Put_Image make the new big
> > numbers nearly work like numeric types (they are not). A difference: The
> > range syntax for instance in loops A .. B is illegal.
> I understand that the range syntax in loops implies that the loop variable
> is acting like an enumerated type which is not true for Big_Integers.
>
> What confused me is that I thought I had to convert the numeric literal
> (I'll have to go back and look at the package spec again to get this
> firmly understood.
>
> I have an another question about string slicing: I've tried (obviously
> incorrectly) to use a variable is one of the slice integers. Can this be
> done?
>
> Thanks,
> Ken
Apparently not :-(
gnatmake main.adb
gcc -c main.adb
main.adb:28:67: error: named parameters not permitted for attributes
9 with Ada.Text_IO; use Ada.Text_IO;
10 with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
11 with Ada.Float_Text_IO; use Ada.Float_Text_IO;
12 with Ada.Numerics.Elementary_Functions; use
Ada.Numerics.Elementary_Functions;
13 with Ada.Command_Line; use Ada.Command_Line;
14
15 procedure Main is
16 Substr : String := Argument (1);
17 Nth : Positive := Integer'Value (Argument (2));
18 I, J : Natural;
19 Temp : Float;
20 begin
21 I := 0;
22 J := 0;
23 loop
24 I := I + 1;
25 exit when I >= 10;
26 Temp := 10.0 ** (log (2.0, 10.0) * Float (I));
27 if I >= 4 then
28 if (Float'Image (10.0 ** (log (2.0, 10.0) * Float (I)), Aft =>
0, Exp => 0) (1 .. Substr'Length) = Substr then
29 J := J + 1;
30 if J = Nth then
31 Put (I, 0);
32 New_Line;
33 exit;
34 end if;
35 end if;
36 end if;
37 end loop;
38 end Main;
Thanks,
Ken
On Saturday, July 29, 2023 at 4:49:08 PM UTC-7, Kenneth Wolcott wrote:
> On Saturday, July 29, 2023 at 4:07:17 AM UTC-7, AdaMagica wrote:
> > > Powers_of_2 := Powers_of_2 * To_Big_Integer (2);
> > With the aspect Integer_Literal, also Powers_of_2 * 2 must work. The attributes Integer_Literal, Real_Literal, Put_Image make the new big numbers nearly work like numeric types (they are not). A difference: The range syntax for instance in loops A .. B is illegal.
> I understand that the range syntax in loops implies that the loop variable is acting like an enumerated type which is not true for Big_Integers.
>
> What confused me is that I thought I had to convert the numeric literal (I'll have to go back and look at the package spec again to get this firmly understood.
>
> I have an another question about string slicing: I've tried (obviously incorrectly) to use a variable is one of the slice integers. Can this be done?
>
> Thanks,
> Ken
Apparently not :-(
gnatmake main.adb
gcc -c main.adb
main.adb:28:67: error: named parameters not permitted for attributes
9 with Ada.Text_IO; use Ada.Text_IO;
10 with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
11 with Ada.Float_Text_IO; use Ada.Float_Text_IO;
12 with Ada.Numerics.Elementary_Functions; use Ada.Numerics.Elementary_Functions;
13 with Ada.Command_Line; use Ada.Command_Line;
14
15 procedure Main is
16 Substr : String := Argument (1);
17 Nth : Positive := Integer'Value (Argument (2));
18 I, J : Natural;
19 Temp : Float;
20 begin
21 I := 0;
22 J := 0;
23 loop
24 I := I + 1;
25 exit when I >= 10;
26 Temp := 10.0 ** (log (2.0, 10.0) * Float (I));
27 if I >= 4 then
28 if (Float'Image (10.0 ** (log (2.0, 10.0) * Float (I)), Aft => 0, Exp => 0) (1 .. Substr'Length) = Substr then
29 J := J + 1;
30 if J = Nth then
31 Put (I, 0);
32 New_Line;
33 exit;
34 end if;
35 end if;
36 end if;
37 end loop;
38 end Main;
Thanks,
Ken
On Saturday, July 29, 2023 at 4:07:17 AM UTC-7, AdaMagica wrote:
> > Powers_of_2 := Powers_of_2 * To_Big_Integer (2);
> With the aspect Integer_Literal, also Powers_of_2 * 2 must work. The attributes Integer_Literal, Real_Literal, Put_Image make the new big numbers nearly work like numeric types (they are not). A difference: The range syntax for instance in loops A .. B is illegal.
I understand that the range syntax in loops implies that the loop variable is acting like an enumerated type which is not true for Big_Integers.
What confused me is that I thought I had to convert the numeric literal (I'll have to go back and look at the package spec again to get this firmly understood.
I have an another question about string slicing: I've tried (obviously incorrectly) to use a variable is one of the slice integers. Can this be done?
Thanks,
Ken
> Powers_of_2 := Powers_of_2 * To_Big_Integer (2);
With the aspect Integer_Literal, also Powers_of_2 * 2 must work. The attributes Integer_Literal, Real_Literal, Put_Image make the new big numbers nearly work like numeric types (they are not). A difference: The range syntax for instance in loops A .. B is illegal.
On Friday, July 28, 2023 at 11:21:13 AM UTC-7, Simon Wright wrote:
> This works for me:
> for I in 1 .. Max loop
> Powers_of_2 := Powers_of_2 * To_Big_Integer (2);
> if I >= 4 then
> if To_String (Powers_Of_2)(2 .. 3) = "12" then
> Put ("2^");
> Put (I, 0);
> Put_Line (To_String (Powers_of_2));
> end if;
> end if;
> end loop;
Thanks to all for your responses...
I don't know exactly what I had tried that had failed, but I have learned more now, especially to be more observant.
I was able to simplify my code.
Greatly appreciate your patience with me.
Thanks,
Ken
This works for me: for I in 1 .. Max loop Powers_of_2 := Powers_of_2 * To_Big_Integer (2); if I >= 4 then if To_String (Powers_Of_2)(2 .. 3) = "12" then Put ("2^"); Put (I, 0); Put_Line (To_String (Powers_of_2)); end if; end if; end loop;
To_String (Powers_of_2) (2 .. 3) should also work.
On Thursday, July 27, 2023 at 1:53:38 AM UTC-7, Jeffrey R.Carter wrote:
> On 2023-07-27 07:26, Kenneth Wolcott wrote:
> >
> > When using the Ada Big_Numbers.Big_Integers package, can the To_String function output be sliced?
> >
> > I'd like to slice out the first two digits from the output of the To_String function of Ada.Big_Numbers.Big_Integers.
> >
> > When trying to do the usual string slicing on the output I get a silent failure, it is just as if I typed the null statement.
> It would be helpful if you could show what you're doing and what results you
> get. This
>
> with Ada.Numerics.Discrete_Random;
> with Ada.Text_IO;
>
> procedure Func_Slice is
> subtype Digit is Character range '0' .. '9';
>
> package Random is new Ada.Numerics.Discrete_Random (Result_Subtype => Digit);
>
> Gen : Random.Generator;
>
> function Image (N : in Natural) return String is
> (if N = 0 then "" else Random.Random (Gen) & Image (N - 1) );
> -- Returns a string of N random Digits
> begin -- Func_Slice
> Random.Reset (Gen => Gen);
> Ada.Text_IO.Put_Line (Item => Image (10) (1 .. 2) );
> end Func_Slice;
>
> works as expected
>
> $ gnatmake -m -j0 -gnat12 -gnatan -gnato2 -O2 -fstack-check func_slice.adb
> x86_64-linux-gnu-gcc-12 -c -gnat12 -gnatan -gnato2 -O2 -fstack-check func_slice.adb
> x86_64-linux-gnu-gnatbind-12 -x func_slice.ali
> x86_64-linux-gnu-gnatlink-12 func_slice.ali -O2 -fstack-check
> $ ./func_slice
> 10
> $ ./func_slice
> 51
Hi Jeff;
After going back and exhaustively reviewing the AdaCore Learning Introduction sections on Strings and Arrays, I determined that I was not slicing with the correct syntax for what I wanted to obtain, it seems that I was slicing built-in whitespace, not the digits I was looking for. So I am now extracting the two-digit slice using (2 .. 3) rather than (1 .. 2) and I am now obtaining the desired output. What I was trying to do was to obtain the slice from the string on the fly, not first saving the string to a variable.
This is what I have now (which works great):
---------------------------------------------------------------------------
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
with Ada.Command_Line; use Ada.Command_Line;
with Ada.Numerics.Big_Numbers.Big_Integers; use Ada.Numerics.Big_Numbers.Big_Integers;
procedure Powers_Of_2_With_Leading_Digits_Of_12 is
Max : Positive := Integer'Value (Argument (1));
Powers_of_2 : Big_Positive := 1;
begin
for I in 1 .. Max loop
Powers_of_2 := Powers_of_2 * To_Big_Integer (2);
if I >= 4 then
declare
Powers_of_2_in_String_Format : String := To_String (Powers_of_2);
First_Pair_of_String_Digits : String := Powers_of_2_in_String_Format (2 .. 3);
begin
if First_Pair_of_String_Digits = "12" then
Put ("2^");
Put (I, 0);
Put_Line (To_String (Powers_of_2));
end if;
end; -- declare
end if;
end loop;
end Powers_Of_2_With_Leading_Digits_Of_12;
---------------------------------------------------------------------------
Now I can generalize this to more closely match the task requirements.
I think I tried to incorrectly create the slice from the To_String output directly without creating the variable in which to store the slice, which then requires the declare block.
Thanks,
Ken
On 2023-07-27 07:26, Kenneth Wolcott wrote:
>
> When using the Ada Big_Numbers.Big_Integers package, can the To_String function output be sliced?
>
> I'd like to slice out the first two digits from the output of the To_String function of Ada.Big_Numbers.Big_Integers.
>
> When trying to do the usual string slicing on the output I get a silent failure, it is just as if I typed the null statement.
It would be helpful if you could show what you're doing and what results you
get. This
with Ada.Numerics.Discrete_Random;
with Ada.Text_IO;
procedure Func_Slice is
subtype Digit is Character range '0' .. '9';
package Random is new Ada.Numerics.Discrete_Random (Result_Subtype => Digit);
Gen : Random.Generator;
function Image (N : in Natural) return String is
(if N = 0 then "" else Random.Random (Gen) & Image (N - 1) );
-- Returns a string of N random Digits
begin -- Func_Slice
Random.Reset (Gen => Gen);
Ada.Text_IO.Put_Line (Item => Image (10) (1 .. 2) );
end Func_Slice;
works as expected
$ gnatmake -m -j0 -gnat12 -gnatan -gnato2 -O2 -fstack-check func_slice.adb
x86_64-linux-gnu-gcc-12 -c -gnat12 -gnatan -gnato2 -O2 -fstack-check func_slice.adb
x86_64-linux-gnu-gnatbind-12 -x func_slice.ali
x86_64-linux-gnu-gnatlink-12 func_slice.ali -O2 -fstack-check
$ ./func_slice
10
$ ./func_slice
51
--
Jeff Carter
"I would never want to belong to any club that
would have someone like me for a member."
Annie Hall
41
Hello. I have gcc12 and gnat12 on x86_64 freebsd. I succeed build gnat for cross building to i386 and to aarch64. But I got error when i try to build for armv7. I do not want to build for SMT32 or other board on arm. I want to build for cross building to freebsd on armv7. Received error is: /usr/ports/devel/freebsd-gnat12/work-armv7/.build/./gcc/xgcc -B/usr/ports/devel/freebsd-gnat12/work-armv7/.build/./gcc/ -B/usr/local/gnat12/armv7-gnueabi-freebsd13.1/bin/ -B/usr/local/gnat12/armv7-gnueabi-freebsd13.1/lib/ -isystem /usr/local/gnat12/armv7-gnueabi-freebsd13.1/include -isystem /usr/local/gnat12/armv7-gnueabi-freebsd13.1/sys-include --sysroot=/usr/local/freebsd-sysroot/armv7 -c -g -O2 -W -Wall -gnatpg -nostdinc a-assert.adb -o a-assert.o fatal error, run-time library not installed correctly cannot locate file system.ads compilation abandoned gmake[7]: *** [../gcc-interface/Makefile:301: a-assert.o] Error 1 gmake[7]: Leaving directory '/usr/ports/devel/freebsd-gnat12/work-armv7/.build/gcc/ada/rts' I suspect that there's a try to build with STM32 runtime. It's true? ` What should I add to the configuration to get arm OS runtime, like with aarch64? ./configure --target=armv7-gnueabi-freebsd13.1 --disable-nls --enable-languages="c,ada" \ --enable-gnu-indirect-function \ --with-sysroot="/" \ --with-build-sysroot="/usr/local/freebsd-sysroot/armv7" \ --with-as=/usr/local/bin/arm-gnueabi-freebsd13.1-as \ --with-ld=/usr/local/bin/arm-gnueabi-freebsd13.1-ld \ --enable-threads=posix \ --disable-libquadmath \ --enable-host-shared \ --disable-libmudflap \ --with-system-zlib \ --disable-libgomp \ --disable-libssp \ --enable-libada \ --without-zstd Thanks.
Hi; When using the Ada Big_Numbers.Big_Integers package, can the To_String function output be sliced? I'd like to slice out the first two digits from the output of the To_String function of Ada.Big_Numbers.Big_Integers. When trying to do the usual string slicing on the output I get a silent failure, it is just as if I typed the null statement. Do I have to save the output to a variable via a declare block in order to get the slice to work? This question is prompted by my attempt to solve the Rosetta Code task: https://rosettacode.org/wiki/First_power_of_2_that_has_leading_decimal_digits_of_12 Thanks, Ken Wolcott
On Wednesday, July 26, 2023 at 12:57:40 PM UTC-7, Jeffrey R.Carter wrote:
> On 2023-07-26 20:30, Kenneth Wolcott wrote:
> >
> > Thank you for your suggestion. Doesn't seem to have any effect.
> Interesting. I get the same results with GNAT 12.
>
> Looking more closely at the code, I think the error, while its msg is
> misleading, is correct. A function that returns a limited type can only return
> an aggregate, a function call, or an object declared by an extended return
> statement. The generic formal object None is none of these.
>
> Changing the generic parameter to a function
>
> with function None return Result_Type;
>
> makes the code correct. You need to change the definition of Empty in
> Proper_Divisors
>
> function Empty return Pos_Arr is (1 .. 0 => <>);
>
> and create a function to supply for the 2nd instantiation
>
> function None return Natural is (0);
> ...
> package Divisor_Count is new Generic_Divisors
> (Result_Type => Natural, None => None, One => Cnt, Add => "+");
>
> and then it compiles and runs.
>
> Another possibility is to make Result_Type simply private, though that is
> slightly less general. That may be how the OP got the code to compile and run.
> It might be that limited was added later because the OP saw that it could be,
> and never tested the change.
Hi Jeff;
Thank you for your reply.
I went with the latter suggestion for my local use.
Ken
On Wednesday, July 26, 2023 at 2:36:17 PM UTC-7, Gautier write-only address wrote:
> > Regarding HAC, isn't that Windows-only?
> Not at all :-)
Downloaded and ran demo. Will experiment further as time permits. Nice!
Thanks,
Ken
> Regarding HAC, isn't that Windows-only?
Not at all :-)
On 2023-07-26 20:30, Kenneth Wolcott wrote:
>
> Thank you for your suggestion. Doesn't seem to have any effect.
Interesting. I get the same results with GNAT 12.
Looking more closely at the code, I think the error, while its msg is
misleading, is correct. A function that returns a limited type can only return
an aggregate, a function call, or an object declared by an extended return
statement. The generic formal object None is none of these.
Changing the generic parameter to a function
with function None return Result_Type;
makes the code correct. You need to change the definition of Empty in
Proper_Divisors
function Empty return Pos_Arr is (1 .. 0 => <>);
and create a function to supply for the 2nd instantiation
function None return Natural is (0);
...
package Divisor_Count is new Generic_Divisors
(Result_Type => Natural, None => None, One => Cnt, Add => "+");
and then it compiles and runs.
Another possibility is to make Result_Type simply private, though that is
slightly less general. That may be how the OP got the code to compile and run.
It might be that limited was added later because the OP saw that it could be,
and never tested the change.
--
Jeff Carter
"I'm a lumberjack and I'm OK."
Monty Python's Flying Circus
54
On Wednesday, July 26, 2023 at 1:36:15 AM UTC-7, Jeffrey R.Carter wrote:
> For some reason your gnatmake seems to be defaulting to -gnat05 mode. This code
> has an expression function, which is Ada 12, so try adding -gnat12 to the command.
>
> You also should not need to put "./" in front of the file name, though I don't
> see how that would make a difference.
Hi Jeff;
Thank you for your suggestion. Doesn't seem to have any effect.
(*SIGH*)
gnatmake -vh -gnat2012 proper_divisors.adb
GNATMAKE 13.1.0
Copyright (C) 1992-2023, Free Software Foundation, Inc.
"proper_divisors.ali" being checked ...
-> "proper_divisors.ali" missing.
gcc -c -gnat2012 proper_divisors.adb
generic_divisors.ads:11:08: error: (Ada 2005) cannot copy object of a limited type (RM-2005 6.5(5.5/2))
generic_divisors.ads:11:08: error: return by reference not permitted in Ada 2005
End of compilation
gnatmake: "proper_divisors.adb" compilation error
Ken
On 2023-07-26 06:49, Kenneth Wolcott wrote:
>
> https://rosettacode.org/wiki/Proper_divisors#Ada
>
> gnatmake -vh ./proper_divisors.adb
>
> generic_divisors.ads:11:08: error: (Ada 2005) cannot copy object of a limited type (RM-2005 6.5(5.5/2))
> generic_divisors.ads:11:08: error: return by reference not permitted in Ada 2005
>
> Why does this work for the the submitter of the Rosetta Code task and not for me?
For some reason your gnatmake seems to be defaulting to -gnat05 mode. This code
has an expression function, which is Ada 12, so try adding -gnat12 to the command.
You also should not need to put "./" in front of the file name, though I don't
see how that would make a difference.
--
Jeff Carter
"I'm a lumberjack and I'm OK."
Monty Python's Flying Circus
54
Kenneth Wolcott <kennethwolcott@gmail.com> writes:
> Regarding HAC, isn't that Windows-only? I'm on a Mac (M1 chip). I'll
> look again at HAC.
It worked well enough for me to find a failing test case (now fixed!)
Hi; Trying to understand (and use) a Rosetta Code task (Proper divisors)... https://rosettacode.org/wiki/Proper_divisors#Ada it fails to compile gnatmake -vh ./proper_divisors.adb GNATMAKE 13.1.0 Copyright (C) 1992-2023, Free Software Foundation, Inc. "proper_divisors.ali" being checked ... -> "proper_divisors.ali" missing. gcc -c -I./ -I- ./proper_divisors.adb generic_divisors.ads:11:08: error: (Ada 2005) cannot copy object of a limited type (RM-2005 6.5(5.5/2)) generic_divisors.ads:11:08: error: return by reference not permitted in Ada 2005 End of compilation gnatmake: "./proper_divisors.adb" compilation error Why does this work for the the submitter of the Rosetta Code task and not for me? Thanks, Ken Wolcott
On Monday, July 24, 2023 at 2:18:28 PM UTC-7, Gautier write-only address wrote:
> > So, any resources on how to write Ada programs that take advantage of memoization?
> Look here https://forum.ada-lang.io/ for discussions about Advent of Code puzzles. Some solutions use (and need, for completing in a reasonable time) memoization.
> You find with HAC ( https://hacadacompiler.sourceforge.io/ ) a set of solutions (search "memoiz*" or "cache"), mostly compiling with the HAC subset.
Thanks for the pointer to the forum.
Regarding HAC, isn't that Windows-only? I'm on a Mac (M1 chip). I'll look again at HAC.
Ken
> So, any resources on how to write Ada programs that take advantage of memoization? Look here https://forum.ada-lang.io/ for discussions about Advent of Code puzzles. Some solutions use (and need, for completing in a reasonable time) memoization. You find with HAC ( https://hacadacompiler.sourceforge.io/ ) a set of solutions (search "memoiz*" or "cache"), mostly compiling with the HAC subset.
On Friday, July 21, 2023 at 8:50:06 PM UTC-7, Kenneth Wolcott wrote:
> Hi;
>
> I'm working on the Rosetta Code task:
>
> "Stirling numbers of the second kind"
>
> I have a working recursive solution written in Ada but I'd like to memoize it to cut down on the redundant and duplicative calls (similar to a recursive solution to calculating the Fibonacci sequence).
>
> So I think I need a hash ADT (which I've used in Perl) but I've never used in Ada.
>
> So I want to preserve the calculation of the Stirling2 for each N and K so I can do a lookup. If this were based on a single unsigned integer, an array would suffice. Maybe a 2d array would suffice?
>
> Thanks,
> Ken Wolcott
I solved the specific problem using a 2d array for caching. This is not memoization, per se, but this works very well. The recursive calls are now very fast as there is a maximum of one calculation per recursive call.
So, any resources on how to write Ada programs that take advantage of memoization?
Thanks,
Ken
Hi; I'm working on the Rosetta Code task: "Stirling numbers of the second kind" I have a working recursive solution written in Ada but I'd like to memoize it to cut down on the redundant and duplicative calls (similar to a recursive solution to calculating the Fibonacci sequence). So I think I need a hash ADT (which I've used in Perl) but I've never used in Ada. So I want to preserve the calculation of the Stirling2 for each N and K so I can do a lookup. If this were based on a single unsigned integer, an array would suffice. Maybe a 2d array would suffice? Thanks, Ken Wolcott
On 10/7/23 15:09, Rod Kay wrote:
> Glug ... I jumped the gun a bit.
>
> There is a security issue to be resolved. The above link will not
> show the full details til then.
>
> I'll re-post when the problem is fixed.
Ok, security problem resolved. All green to go :).
On 13/7/23 04:48, Blady wrote: > > a) gnat/building_executable_programs_with_gnat.rst > I saw you add it in your distribution [1]. > I took mine from 23.0w version from [2]. > There are different. > Where did yours come from? > I think it came from the 2021 community release. Yours will be more recent, so I will update to that version. Thanks for mentioning this. > b) design/scripts/update_predefined_ada.py > I didn't find it, did you? > No, sorry, I've not seen that file before. Regards.
On 2023-07-14 21:17, Jeffrey R.Carter wrote: > I have a generic pkg; > > with Ada.Containers.Vectors; > > generic -- Vector_Conversions > type Index is range <>; > type Element is private; > type Fixed is array (Index range <>) of Element; > > with function "=" (Left : in Element; Right : in Element) return Boolean > is <>; Oops! This "=" should be removed to get the behavior described. > > with package Unbounded is new Ada.Containers.Vectors > (Index_Type => Index, Element_Type => Element); > package Vector_Conversions is > -- Empty > end Vector_Conversions; > > and an instantiation of > > with Ada.Containers.Vectors; > with Ada.Strings.Unbounded; > with Vector_Conversions; > > procedure Instance_Test is > use Ada.Strings.Unbounded; > > package String_Lists is new Ada.Containers.Vectors > (Index_Type => Positive, Element_Type => Unbounded_String); > > type String_List is array (Positive range <>) of Unbounded_String; > > package Conversions is new Vector_Conversions > (Index => Positive, > Element => Unbounded_String, > Fixed => String_List, > Unbounded => String_Lists); > begin -- Instance_Test > null; > end Instance_Test; > > Compiler G compiles this and it works fine. > > Compiler O fails to compile the instantiation with the error msg "The subprogram > actuals for the formal package and actual package must statically denote the > same entity", pointing to the Unbounded parameter association and referencing > ARM 12.7(8). If I add an explicit "=" with "is <>" to Vector_Conversions, then > compiler O compiles it and it works fine. > > Possibly one of the compilers has an error, but possibly they're both correct, > and I'm wondering if it's possible to tell which is the case. > > (If anyone is interested, the actual generic pkg where I encountered this is > PragmARC.Conversions.Vectors from the PragmAda Reusable Components > [https://github.com/jrcarter/PragmARC]), and I will supply the actual code that > instantiates it on demand. What I've presented is a first attempt at a minimal > reproducer.) > -- Jeff Carter "Make sure your code 'does nothing' gracefully." Elements of Programming Style 196
I have a generic pkg; with Ada.Containers.Vectors; generic -- Vector_Conversions type Index is range <>; type Element is private; type Fixed is array (Index range <>) of Element; with function "=" (Left : in Element; Right : in Element) return Boolean is <>; with package Unbounded is new Ada.Containers.Vectors (Index_Type => Index, Element_Type => Element); package Vector_Conversions is -- Empty end Vector_Conversions; and an instantiation of with Ada.Containers.Vectors; with Ada.Strings.Unbounded; with Vector_Conversions; procedure Instance_Test is use Ada.Strings.Unbounded; package String_Lists is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => Unbounded_String); type String_List is array (Positive range <>) of Unbounded_String; package Conversions is new Vector_Conversions (Index => Positive, Element => Unbounded_String, Fixed => String_List, Unbounded => String_Lists); begin -- Instance_Test null; end Instance_Test; Compiler G compiles this and it works fine. Compiler O fails to compile the instantiation with the error msg "The subprogram actuals for the formal package and actual package must statically denote the same entity", pointing to the Unbounded parameter association and referencing ARM 12.7(8). If I add an explicit "=" with "is <>" to Vector_Conversions, then compiler O compiles it and it works fine. Possibly one of the compilers has an error, but possibly they're both correct, and I'm wondering if it's possible to tell which is the case. (If anyone is interested, the actual generic pkg where I encountered this is PragmARC.Conversions.Vectors from the PragmAda Reusable Components [https://github.com/jrcarter/PragmARC]), and I will supply the actual code that instantiates it on demand. What I've presented is a first attempt at a minimal reproducer.) -- Jeff Carter "Make sure your code 'does nothing' gracefully." Elements of Programming Style 196
On Thursday, July 13, 2023 at 7:14:01 AM UTC-7, Rod Kay wrote: > On 13/7/23 20:59, Luke A. Guest wrote: > > Can you edit your replies cutting out irrelevant stuff so I don't have > > to scroll through pages of stuff? Luke (and others): I'm sorry, I know better, I was being lazy :-( > Or perhaps open an issue in the sdlada github project. Rod; That is probably what I should have done initially. Ken
On 13/7/23 20:59, Luke A. Guest wrote:
> Can you edit your replies cutting out irrelevant stuff so I don't have
> to scroll through pages of stuff?
>
Or perhaps open an issue in the sdlada github project.
Regards.
Can you edit your replies cutting out irrelevant stuff so I don't have to scroll through pages of stuff?
On Wednesday, July 12, 2023 at 4:09:38 PM UTC-7, Kenneth Wolcott wrote: > On Wednesday, July 12, 2023 at 8:44:20 AM UTC-7, Luke A. Guest wrote: > > On 12/07/2023 07:01, Kenneth Wolcott wrote: > > > On Tuesday, July 11, 2023 at 10:43:37 PM UTC-7, Kenneth Wolcott wrote: > > >> On Thursday, July 6, 2023 at 6:25:42 PM UTC-7, Kenneth Wolcott wrote: > > >>> On Thursday, July 6, 2023 at 6:23:51 PM UTC-7, Kenneth Wolcott wrote: > > >>>> On Thursday, July 6, 2023 at 12:37:20 PM UTC-7, Kenneth Wolcott wrote: > > >>>>> On Tuesday, July 4, 2023 at 2:00:11 AM UTC-7, Luke A. Guest wrote: > > >>>>>> On 04/07/2023 00:58, Kenneth Wolcott wrote: > > >>>>>>> On Monday, July 3, 2023 at 4:24:37 PM UTC-7, Keith Thompson wrote: > > >>>>>>>> Kenneth Wolcott writes: > > >>>>>>>> [...] > > >>>>>>>>> After adding a semi-colon at the following line in sdlada.gpr > > >>>>>>>>> > > >>>>>>>>> for Default_Swiches ("Ada") use ("-gnat202", "-gnata"); > > >>>>>>>> [...] > > >>>>>>>> > > >>>>>>>> Unless "-gnat202" requests the version of Ada that was current during > > >>>>>>>> the reign of Septimius Severus, you probably want to use "-gnat2022". > > >>>>>>>> (Options can be abbreviated, but "-gnat202" may become ambiguous if > > >>>>>>>> there's a new Ada standard before 2030.) > > >>>>>>>> > > >>>>>>>> Also "Default_Swiches" is mispelled. > > >>>>>>>> > > >>>>>>>> If the typos are the result of re-typing that line, I strongly suggest > > >>>>>>>> copy-and-pasting any code you post. > > >>>>>>>> > > >>>>>>>> -- > > >>>>>>>> Keith Thompson > > >>>>>>> > > >>>>>>> Thank you, Keith :-) > > >>>>>>> > > >>>>>>> Fixed those two typos. > > >>>>>>> > > >>>>>>> Here's the current output from trying to build: > > >>>>>>> > > >>>>>>> make SDL_PLATFORM=macos_ports SDL_MODE=debug > > >>>>>>> mkdir -p gen/src/ > > >>>>>>> gprbuild -p -gnat2012 -XSDL_MODE=debug -XSDL_PLATFORM=macos_ports \ > > >>>>>>> -Psdlada.gpr > > >>>>>>> sdlada.gpr:26:09: a variable cannot be declared for the first time here > > >>>>>>> sdlada.gpr:26:23: unknown variable "C_Switches" > > >>>>>>> gprbuild: "sdlada.gpr" processing failed > > >>>>>>> make: *** [lib/libadasdl.a] Error 5 > > >>>>>>> > > >>>>>>> Thanks, > > >>>>>>> Ken > > >>>>>> This makes no sense, line 26 is this: > > >>>>>> Source_Platform := "../../src/" & Platform; > > >>>>> Hi Luke; > > >>>>> > > >>>>> Is it possible for us to arrange a process to send the patch to me in another means? If Google Groups blocks attachments and I'm getting massively confused with the content being pasted inside the posting, we need to derive another means of communicating. I can share a different email address which is already being heavily spammed... > > >>>>> > > >>>>> Thanks, > > >>>>> Ken > > >>>> Hi Luke; > > >>>> > > >>>> Please email the patch to me as an attachment using the email address: [redacted :-) ] > > >>>> > > >>>> Please also provide a checksum of some kind so I know that the file didn't get corrupted en-route. > > >>>> > > >>>> Thanks, > > >>>> Ken > > >>> The email address is kwolcott at yahoo dot com. > > >> Hi Luke; > > >> > > >> Thanks for the patch via email. > > >> > > >> The md5sum matches... > > >> > > >> I ran git restore in the sdlada git clone directory... > > >> > > >> I then applied the patch: > > >> > > >> patch -p1 < test.patch > > >> patching file 'build/gnat/makefile' > > >> patching file 'build/gnat/sdlada.gpr' > > >> patching file 'build/gnat/sdlada_image.gpr' > > >> Reversed (or previously applied) patch detected! Assume -R? [y] y > > >> patching file 'build/gnat/tests.gpr' > > >> Reversed (or previously applied) patch detected! Assume -R? [y] y > > >> patching file 'build/gnat/tests_image.gpr' > > >> Reversed (or previously applied) patch detected! Assume -R? [y] y > > >> patching file 'build/gnat/unit_tests.gpr' > > >> Reversed (or previously applied) patch detected! Assume -R? [y] y > > >> patching file 'src/image/version_images.c' > > >> Reversed (or previously applied) patch detected! Assume -R? [y] y > > >> patching file 'src/ttf/version_ttf.c' > > >> Reversed (or previously applied) patch detected! Assume -R? [y] y > > >> > > >> Attempting to build: > > >> > > >> make SDL_PLATFORM=macos_ports SDL_MODE=release > > >> mkdir -p gen/src/ > > >> gprbuild -p -gnat2012 -XSDL_MODE=release -XSDL_PLATFORM=macos_ports \ > > >> -Psdlada.gpr > > >> Setup > > >> [mkdir] object directory for project SDLAda > > >> sdlada.gpr:1:17: warning: Linker switches not taken into account in library projects > > >> sdlada.gpr:30:39: "../../src/macos_ports" is not a valid directory > > >> gprbuild: "sdlada.gpr" processing failed > > >> make: *** [lib/libadasdl.a] Error 5 > > >> So, what did I do wrong this time? > > >> > > >> Thanks, > > >> Ken > > > > > > > > > Ok, > > > > > > I deleted the contents of the sdlada git clone directory... > > > > > > then did a git restore . > > > > > > then applied the patch > > > > > > then ran make. > > > > > > Still fails... > > > > > > ***************************************************************** > > > patch -p1 < test.patch > > > patching file 'build/gnat/makefile' > > > patching file 'build/gnat/sdlada.gpr' > > > patching file 'build/gnat/sdlada_image.gpr' > > > patching file 'build/gnat/tests.gpr' > > > patching file 'build/gnat/tests_image.gpr' > > > patching file 'build/gnat/unit_tests.gpr' > > > patching file 'src/image/version_images.c' > > > patching file 'src/ttf/version_ttf.c' > > > sdlada: cd build/gnat > > > gnat: make SDL_PLATFORM=macos_ports SDL_MODE=release > > > mkdir -p gen/src/ > > > gprbuild -p -gnat2012 -XSDL_MODE=release -XSDL_PLATFORM=macos_ports \ > > > -Ptools.gpr > > > Setup > > > [mkdir] object directory for project Tools > > > Compile > > > [Ada] gen_keyboard.adb > > > [Ada] scancodes.ads > > > [Ada] utils.adb > > > Bind > > > [gprbind] gen_keyboard.bexch > > > [Ada] gen_keyboard.ali > > > Link > > > [link] gen_keyboard.adb > > > ./gen/release/tools/gen_keyboard > gen/src/sdl-events-keyboards.ads > > > gprbuild -p -gnat2012 -XSDL_MODE=release -XSDL_PLATFORM=macos_ports \ > > > -Psdlada.gpr > > > Setup > > > [mkdir] object directory for project SDLAda > > > sdlada.gpr:1:17: warning: Linker switches not taken into account in library projects > > > sdlada.gpr:30:39: "../../src/macos_ports" is not a valid directory > > > gprbuild: "sdlada.gpr" processing failed > > > make: *** [lib/libadasdl.a] Error 5 > > > ***************************************************************** > > Check the sdlada.gpr, it will get the platform name as the src dir too, > > I forgot about that. Change: > > case Platform is > > when "macos_homebrew" => > > to: > > > > case Platform is > > when "macos_homebrew" | "macos_ports" | "macosx" => > After > 1. Completely deleting the cloned instance of sdlada; 1.5. Running git clone again to obtain fresh sdlada source :-) > 2. Applying the patch you provided via email; > 3. manually modifying sdlada.gpr as you directed above; > > We have the following result: > ********************************************* > make SDL_PLATFORM=macos_ports SDL_MODE=release > mkdir -p gen/src/ > gprbuild -p -gnat2012 -XSDL_MODE=release -XSDL_PLATFORM=macos_ports \ > -Ptools.gpr > Setup > [mkdir] object directory for project Tools > Compile > [Ada] gen_keyboard.adb > [Ada] scancodes.ads > [Ada] utils.adb > Bind > [gprbind] gen_keyboard.bexch > [Ada] gen_keyboard.ali > Link > [link] gen_keyboard.adb > ./gen/release/tools/gen_keyboard > gen/src/sdl-events-keyboards.ads > gprbuild -p -gnat2012 -XSDL_MODE=release -XSDL_PLATFORM=macos_ports \ > -Psdlada.gpr > Setup > [mkdir] object directory for project SDLAda > sdlada.gpr:1:17: warning: Linker switches not taken into account in library projects > Compile > [C] version_ttf.c > [REDACTED]/sdlada/src/ttf/version_ttf.c:25:18: fatal error: SDL2/SDL_ttf.h: No such file or directory > 25 | #include <SDL2/SDL_ttf.h> > | ^~~~~~~~~~~~~~~~ > compilation terminated. > gprbuild: *** compilation phase failed > make: *** [lib/libadasdl.a] Error 4 > *********************************************
On Wednesday, July 12, 2023 at 8:44:20 AM UTC-7, Luke A. Guest wrote:
> On 12/07/2023 07:01, Kenneth Wolcott wrote:
> > On Tuesday, July 11, 2023 at 10:43:37 PM UTC-7, Kenneth Wolcott wrote:
> >> On Thursday, July 6, 2023 at 6:25:42 PM UTC-7, Kenneth Wolcott wrote:
> >>> On Thursday, July 6, 2023 at 6:23:51 PM UTC-7, Kenneth Wolcott wrote:
> >>>> On Thursday, July 6, 2023 at 12:37:20 PM UTC-7, Kenneth Wolcott wrote:
> >>>>> On Tuesday, July 4, 2023 at 2:00:11 AM UTC-7, Luke A. Guest wrote:
> >>>>>> On 04/07/2023 00:58, Kenneth Wolcott wrote:
> >>>>>>> On Monday, July 3, 2023 at 4:24:37 PM UTC-7, Keith Thompson wrote:
> >>>>>>>> Kenneth Wolcott writes:
> >>>>>>>> [...]
> >>>>>>>>> After adding a semi-colon at the following line in sdlada.gpr
> >>>>>>>>>
> >>>>>>>>> for Default_Swiches ("Ada") use ("-gnat202", "-gnata");
> >>>>>>>> [...]
> >>>>>>>>
> >>>>>>>> Unless "-gnat202" requests the version of Ada that was current during
> >>>>>>>> the reign of Septimius Severus, you probably want to use "-gnat2022".
> >>>>>>>> (Options can be abbreviated, but "-gnat202" may become ambiguous if
> >>>>>>>> there's a new Ada standard before 2030.)
> >>>>>>>>
> >>>>>>>> Also "Default_Swiches" is mispelled.
> >>>>>>>>
> >>>>>>>> If the typos are the result of re-typing that line, I strongly suggest
> >>>>>>>> copy-and-pasting any code you post.
> >>>>>>>>
> >>>>>>>> --
> >>>>>>>> Keith Thompson
> >>>>>>>
> >>>>>>> Thank you, Keith :-)
> >>>>>>>
> >>>>>>> Fixed those two typos.
> >>>>>>>
> >>>>>>> Here's the current output from trying to build:
> >>>>>>>
> >>>>>>> make SDL_PLATFORM=macos_ports SDL_MODE=debug
> >>>>>>> mkdir -p gen/src/
> >>>>>>> gprbuild -p -gnat2012 -XSDL_MODE=debug -XSDL_PLATFORM=macos_ports \
> >>>>>>> -Psdlada.gpr
> >>>>>>> sdlada.gpr:26:09: a variable cannot be declared for the first time here
> >>>>>>> sdlada.gpr:26:23: unknown variable "C_Switches"
> >>>>>>> gprbuild: "sdlada.gpr" processing failed
> >>>>>>> make: *** [lib/libadasdl.a] Error 5
> >>>>>>>
> >>>>>>> Thanks,
> >>>>>>> Ken
> >>>>>> This makes no sense, line 26 is this:
> >>>>>> Source_Platform := "../../src/" & Platform;
> >>>>> Hi Luke;
> >>>>>
> >>>>> Is it possible for us to arrange a process to send the patch to me in another means? If Google Groups blocks attachments and I'm getting massively confused with the content being pasted inside the posting, we need to derive another means of communicating. I can share a different email address which is already being heavily spammed...
> >>>>>
> >>>>> Thanks,
> >>>>> Ken
> >>>> Hi Luke;
> >>>>
> >>>> Please email the patch to me as an attachment using the email address: [redacted :-) ]
> >>>>
> >>>> Please also provide a checksum of some kind so I know that the file didn't get corrupted en-route.
> >>>>
> >>>> Thanks,
> >>>> Ken
> >>> The email address is kwolcott at yahoo dot com.
> >> Hi Luke;
> >>
> >> Thanks for the patch via email.
> >>
> >> The md5sum matches...
> >>
> >> I ran git restore in the sdlada git clone directory...
> >>
> >> I then applied the patch:
> >>
> >> patch -p1 < test.patch
> >> patching file 'build/gnat/makefile'
> >> patching file 'build/gnat/sdlada.gpr'
> >> patching file 'build/gnat/sdlada_image.gpr'
> >> Reversed (or previously applied) patch detected! Assume -R? [y] y
> >> patching file 'build/gnat/tests.gpr'
> >> Reversed (or previously applied) patch detected! Assume -R? [y] y
> >> patching file 'build/gnat/tests_image.gpr'
> >> Reversed (or previously applied) patch detected! Assume -R? [y] y
> >> patching file 'build/gnat/unit_tests.gpr'
> >> Reversed (or previously applied) patch detected! Assume -R? [y] y
> >> patching file 'src/image/version_images.c'
> >> Reversed (or previously applied) patch detected! Assume -R? [y] y
> >> patching file 'src/ttf/version_ttf.c'
> >> Reversed (or previously applied) patch detected! Assume -R? [y] y
> >>
> >> Attempting to build:
> >>
> >> make SDL_PLATFORM=macos_ports SDL_MODE=release
> >> mkdir -p gen/src/
> >> gprbuild -p -gnat2012 -XSDL_MODE=release -XSDL_PLATFORM=macos_ports \
> >> -Psdlada.gpr
> >> Setup
> >> [mkdir] object directory for project SDLAda
> >> sdlada.gpr:1:17: warning: Linker switches not taken into account in library projects
> >> sdlada.gpr:30:39: "../../src/macos_ports" is not a valid directory
> >> gprbuild: "sdlada.gpr" processing failed
> >> make: *** [lib/libadasdl.a] Error 5
> >> So, what did I do wrong this time?
> >>
> >> Thanks,
> >> Ken
> >
> >
> > Ok,
> >
> > I deleted the contents of the sdlada git clone directory...
> >
> > then did a git restore .
> >
> > then applied the patch
> >
> > then ran make.
> >
> > Still fails...
> >
> > *****************************************************************
> > patch -p1 < test.patch
> > patching file 'build/gnat/makefile'
> > patching file 'build/gnat/sdlada.gpr'
> > patching file 'build/gnat/sdlada_image.gpr'
> > patching file 'build/gnat/tests.gpr'
> > patching file 'build/gnat/tests_image.gpr'
> > patching file 'build/gnat/unit_tests.gpr'
> > patching file 'src/image/version_images.c'
> > patching file 'src/ttf/version_ttf.c'
> > sdlada: cd build/gnat
> > gnat: make SDL_PLATFORM=macos_ports SDL_MODE=release
> > mkdir -p gen/src/
> > gprbuild -p -gnat2012 -XSDL_MODE=release -XSDL_PLATFORM=macos_ports \
> > -Ptools.gpr
> > Setup
> > [mkdir] object directory for project Tools
> > Compile
> > [Ada] gen_keyboard.adb
> > [Ada] scancodes.ads
> > [Ada] utils.adb
> > Bind
> > [gprbind] gen_keyboard.bexch
> > [Ada] gen_keyboard.ali
> > Link
> > [link] gen_keyboard.adb
> > ./gen/release/tools/gen_keyboard > gen/src/sdl-events-keyboards.ads
> > gprbuild -p -gnat2012 -XSDL_MODE=release -XSDL_PLATFORM=macos_ports \
> > -Psdlada.gpr
> > Setup
> > [mkdir] object directory for project SDLAda
> > sdlada.gpr:1:17: warning: Linker switches not taken into account in library projects
> > sdlada.gpr:30:39: "../../src/macos_ports" is not a valid directory
> > gprbuild: "sdlada.gpr" processing failed
> > make: *** [lib/libadasdl.a] Error 5
> > *****************************************************************
> Check the sdlada.gpr, it will get the platform name as the src dir too,
> I forgot about that. Change:
> case Platform is
> when "macos_homebrew" =>
> to:
>
> case Platform is
> when "macos_homebrew" | "macos_ports" | "macosx" =>
After
1. Completely deleting the cloned instance of sdlada;
2. Applying the patch you provided via email;
3. manually modifying sdlada.gpr as you directed above;
We have the following result:
*********************************************
make SDL_PLATFORM=macos_ports SDL_MODE=release
mkdir -p gen/src/
gprbuild -p -gnat2012 -XSDL_MODE=release -XSDL_PLATFORM=macos_ports \
-Ptools.gpr
Setup
[mkdir] object directory for project Tools
Compile
[Ada] gen_keyboard.adb
[Ada] scancodes.ads
[Ada] utils.adb
Bind
[gprbind] gen_keyboard.bexch
[Ada] gen_keyboard.ali
Link
[link] gen_keyboard.adb
./gen/release/tools/gen_keyboard > gen/src/sdl-events-keyboards.ads
gprbuild -p -gnat2012 -XSDL_MODE=release -XSDL_PLATFORM=macos_ports \
-Psdlada.gpr
Setup
[mkdir] object directory for project SDLAda
sdlada.gpr:1:17: warning: Linker switches not taken into account in library projects
Compile
[C] version_ttf.c
[REDACTED]/sdlada/src/ttf/version_ttf.c:25:18: fatal error: SDL2/SDL_ttf.h: No such file or directory
25 | #include <SDL2/SDL_ttf.h>
| ^~~~~~~~~~~~~~~~
compilation terminated.
gprbuild: *** compilation phase failed
make: *** [lib/libadasdl.a] Error 4
*********************************************
Le 04/07/2023 à 10:03, Rod Kay a écrit : > On 1/7/23 17:36, Blady wrote: >> >> Hello Rod, >> >> Thanks for sharing, I'll take a look. >> >> I'm building GnatStudio for macOS Ventura. >> Currently at step Ada Language Server, next to the step GnatStudio >> itself ;-) >> >> I'll be sure to share my progress. > > Hi Pascal, > > How is the Ventura build going ? If anything in the 'cookbook' is > unclear or problematic, don't hesitate to ask. > >> In the meantime here is my approach for version 23.0w (in French >> language): >> http://blady.pagesperso-orange.fr/telechargements/gnat/Install-GS-Quartz_WF.pdf >> > > Errr, my Francais is a little rusty :) but good luck (bonne chance?) ! Hi Rod, The Ada compilation of GS is done. But some files seems missing on Python side. a) gnat/building_executable_programs_with_gnat.rst I saw you add it in your distribution [1]. I took mine from 23.0w version from [2]. There are different. Where did yours come from? b) design/scripts/update_predefined_ada.py I didn't find it, did you? Regards, Pascal. [1] https://github.com/charlie5/archlinux-gnatstudio-support/blob/main/gnatstudio-cookbook/28.0-gnatstudio/building_executable_programs_with_gnat.rst [2] https://github.com/AdaCore/gnatstudio/releases/tag/gnatstudio-cr-20220512
On 12/07/2023 07:01, Kenneth Wolcott wrote:
> On Tuesday, July 11, 2023 at 10:43:37 PM UTC-7, Kenneth Wolcott wrote:
>> On Thursday, July 6, 2023 at 6:25:42 PM UTC-7, Kenneth Wolcott wrote:
>>> On Thursday, July 6, 2023 at 6:23:51 PM UTC-7, Kenneth Wolcott wrote:
>>>> On Thursday, July 6, 2023 at 12:37:20 PM UTC-7, Kenneth Wolcott wrote:
>>>>> On Tuesday, July 4, 2023 at 2:00:11 AM UTC-7, Luke A. Guest wrote:
>>>>>> On 04/07/2023 00:58, Kenneth Wolcott wrote:
>>>>>>> On Monday, July 3, 2023 at 4:24:37 PM UTC-7, Keith Thompson wrote:
>>>>>>>> Kenneth Wolcott writes:
>>>>>>>> [...]
>>>>>>>>> After adding a semi-colon at the following line in sdlada.gpr
>>>>>>>>>
>>>>>>>>> for Default_Swiches ("Ada") use ("-gnat202", "-gnata");
>>>>>>>> [...]
>>>>>>>>
>>>>>>>> Unless "-gnat202" requests the version of Ada that was current during
>>>>>>>> the reign of Septimius Severus, you probably want to use "-gnat2022".
>>>>>>>> (Options can be abbreviated, but "-gnat202" may become ambiguous if
>>>>>>>> there's a new Ada standard before 2030.)
>>>>>>>>
>>>>>>>> Also "Default_Swiches" is mispelled.
>>>>>>>>
>>>>>>>> If the typos are the result of re-typing that line, I strongly suggest
>>>>>>>> copy-and-pasting any code you post.
>>>>>>>>
>>>>>>>> --
>>>>>>>> Keith Thompson
>>>>>>>
>>>>>>> Thank you, Keith :-)
>>>>>>>
>>>>>>> Fixed those two typos.
>>>>>>>
>>>>>>> Here's the current output from trying to build:
>>>>>>>
>>>>>>> make SDL_PLATFORM=macos_ports SDL_MODE=debug
>>>>>>> mkdir -p gen/src/
>>>>>>> gprbuild -p -gnat2012 -XSDL_MODE=debug -XSDL_PLATFORM=macos_ports \
>>>>>>> -Psdlada.gpr
>>>>>>> sdlada.gpr:26:09: a variable cannot be declared for the first time here
>>>>>>> sdlada.gpr:26:23: unknown variable "C_Switches"
>>>>>>> gprbuild: "sdlada.gpr" processing failed
>>>>>>> make: *** [lib/libadasdl.a] Error 5
>>>>>>>
>>>>>>> Thanks,
>>>>>>> Ken
>>>>>> This makes no sense, line 26 is this:
>>>>>> Source_Platform := "../../src/" & Platform;
>>>>> Hi Luke;
>>>>>
>>>>> Is it possible for us to arrange a process to send the patch to me in another means? If Google Groups blocks attachments and I'm getting massively confused with the content being pasted inside the posting, we need to derive another means of communicating. I can share a different email address which is already being heavily spammed...
>>>>>
>>>>> Thanks,
>>>>> Ken
>>>> Hi Luke;
>>>>
>>>> Please email the patch to me as an attachment using the email address: [redacted :-) ]
>>>>
>>>> Please also provide a checksum of some kind so I know that the file didn't get corrupted en-route.
>>>>
>>>> Thanks,
>>>> Ken
>>> The email address is kwolcott at yahoo dot com.
>> Hi Luke;
>>
>> Thanks for the patch via email.
>>
>> The md5sum matches...
>>
>> I ran git restore in the sdlada git clone directory...
>>
>> I then applied the patch:
>>
>> patch -p1 < test.patch
>> patching file 'build/gnat/makefile'
>> patching file 'build/gnat/sdlada.gpr'
>> patching file 'build/gnat/sdlada_image.gpr'
>> Reversed (or previously applied) patch detected! Assume -R? [y] y
>> patching file 'build/gnat/tests.gpr'
>> Reversed (or previously applied) patch detected! Assume -R? [y] y
>> patching file 'build/gnat/tests_image.gpr'
>> Reversed (or previously applied) patch detected! Assume -R? [y] y
>> patching file 'build/gnat/unit_tests.gpr'
>> Reversed (or previously applied) patch detected! Assume -R? [y] y
>> patching file 'src/image/version_images.c'
>> Reversed (or previously applied) patch detected! Assume -R? [y] y
>> patching file 'src/ttf/version_ttf.c'
>> Reversed (or previously applied) patch detected! Assume -R? [y] y
>>
>> Attempting to build:
>>
>> make SDL_PLATFORM=macos_ports SDL_MODE=release
>> mkdir -p gen/src/
>> gprbuild -p -gnat2012 -XSDL_MODE=release -XSDL_PLATFORM=macos_ports \
>> -Psdlada.gpr
>> Setup
>> [mkdir] object directory for project SDLAda
>> sdlada.gpr:1:17: warning: Linker switches not taken into account in library projects
>> sdlada.gpr:30:39: "../../src/macos_ports" is not a valid directory
>> gprbuild: "sdlada.gpr" processing failed
>> make: *** [lib/libadasdl.a] Error 5
>> So, what did I do wrong this time?
>>
>> Thanks,
>> Ken
>
>
> Ok,
>
> I deleted the contents of the sdlada git clone directory...
>
> then did a git restore .
>
> then applied the patch
>
> then ran make.
>
> Still fails...
>
> *****************************************************************
> patch -p1 < test.patch
> patching file 'build/gnat/makefile'
> patching file 'build/gnat/sdlada.gpr'
> patching file 'build/gnat/sdlada_image.gpr'
> patching file 'build/gnat/tests.gpr'
> patching file 'build/gnat/tests_image.gpr'
> patching file 'build/gnat/unit_tests.gpr'
> patching file 'src/image/version_images.c'
> patching file 'src/ttf/version_ttf.c'
> sdlada: cd build/gnat
> gnat: make SDL_PLATFORM=macos_ports SDL_MODE=release
> mkdir -p gen/src/
> gprbuild -p -gnat2012 -XSDL_MODE=release -XSDL_PLATFORM=macos_ports \
> -Ptools.gpr
> Setup
> [mkdir] object directory for project Tools
> Compile
> [Ada] gen_keyboard.adb
> [Ada] scancodes.ads
> [Ada] utils.adb
> Bind
> [gprbind] gen_keyboard.bexch
> [Ada] gen_keyboard.ali
> Link
> [link] gen_keyboard.adb
> ./gen/release/tools/gen_keyboard > gen/src/sdl-events-keyboards.ads
> gprbuild -p -gnat2012 -XSDL_MODE=release -XSDL_PLATFORM=macos_ports \
> -Psdlada.gpr
> Setup
> [mkdir] object directory for project SDLAda
> sdlada.gpr:1:17: warning: Linker switches not taken into account in library projects
> sdlada.gpr:30:39: "../../src/macos_ports" is not a valid directory
> gprbuild: "sdlada.gpr" processing failed
> make: *** [lib/libadasdl.a] Error 5
> *****************************************************************
Check the sdlada.gpr, it will get the platform name as the src dir too,
I forgot about that. Change:
case Platform is
when "macos_homebrew" =>
to:
case Platform is
when "macos_homebrew" | "macos_ports" | "macosx" =>
On Tuesday, July 11, 2023 at 10:43:37 PM UTC-7, Kenneth Wolcott wrote:
> On Thursday, July 6, 2023 at 6:25:42 PM UTC-7, Kenneth Wolcott wrote:
> > On Thursday, July 6, 2023 at 6:23:51 PM UTC-7, Kenneth Wolcott wrote:
> > > On Thursday, July 6, 2023 at 12:37:20 PM UTC-7, Kenneth Wolcott wrote:
> > > > On Tuesday, July 4, 2023 at 2:00:11 AM UTC-7, Luke A. Guest wrote:
> > > > > On 04/07/2023 00:58, Kenneth Wolcott wrote:
> > > > > > On Monday, July 3, 2023 at 4:24:37 PM UTC-7, Keith Thompson wrote:
> > > > > >> Kenneth Wolcott writes:
> > > > > >> [...]
> > > > > >>> After adding a semi-colon at the following line in sdlada.gpr
> > > > > >>>
> > > > > >>> for Default_Swiches ("Ada") use ("-gnat202", "-gnata");
> > > > > >> [...]
> > > > > >>
> > > > > >> Unless "-gnat202" requests the version of Ada that was current during
> > > > > >> the reign of Septimius Severus, you probably want to use "-gnat2022".
> > > > > >> (Options can be abbreviated, but "-gnat202" may become ambiguous if
> > > > > >> there's a new Ada standard before 2030.)
> > > > > >>
> > > > > >> Also "Default_Swiches" is mispelled.
> > > > > >>
> > > > > >> If the typos are the result of re-typing that line, I strongly suggest
> > > > > >> copy-and-pasting any code you post.
> > > > > >>
> > > > > >> --
> > > > > >> Keith Thompson
> > > > > >
> > > > > > Thank you, Keith :-)
> > > > > >
> > > > > > Fixed those two typos.
> > > > > >
> > > > > > Here's the current output from trying to build:
> > > > > >
> > > > > > make SDL_PLATFORM=macos_ports SDL_MODE=debug
> > > > > > mkdir -p gen/src/
> > > > > > gprbuild -p -gnat2012 -XSDL_MODE=debug -XSDL_PLATFORM=macos_ports \
> > > > > > -Psdlada.gpr
> > > > > > sdlada.gpr:26:09: a variable cannot be declared for the first time here
> > > > > > sdlada.gpr:26:23: unknown variable "C_Switches"
> > > > > > gprbuild: "sdlada.gpr" processing failed
> > > > > > make: *** [lib/libadasdl.a] Error 5
> > > > > >
> > > > > > Thanks,
> > > > > > Ken
> > > > > This makes no sense, line 26 is this:
> > > > > Source_Platform := "../../src/" & Platform;
> > > > Hi Luke;
> > > >
> > > > Is it possible for us to arrange a process to send the patch to me in another means? If Google Groups blocks attachments and I'm getting massively confused with the content being pasted inside the posting, we need to derive another means of communicating. I can share a different email address which is already being heavily spammed...
> > > >
> > > > Thanks,
> > > > Ken
> > > Hi Luke;
> > >
> > > Please email the patch to me as an attachment using the email address: [redacted :-) ]
> > >
> > > Please also provide a checksum of some kind so I know that the file didn't get corrupted en-route.
> > >
> > > Thanks,
> > > Ken
> > The email address is kwolcott at yahoo dot com.
> Hi Luke;
>
> Thanks for the patch via email.
>
> The md5sum matches...
>
> I ran git restore in the sdlada git clone directory...
>
> I then applied the patch:
>
> patch -p1 < test.patch
> patching file 'build/gnat/makefile'
> patching file 'build/gnat/sdlada.gpr'
> patching file 'build/gnat/sdlada_image.gpr'
> Reversed (or previously applied) patch detected! Assume -R? [y] y
> patching file 'build/gnat/tests.gpr'
> Reversed (or previously applied) patch detected! Assume -R? [y] y
> patching file 'build/gnat/tests_image.gpr'
> Reversed (or previously applied) patch detected! Assume -R? [y] y
> patching file 'build/gnat/unit_tests.gpr'
> Reversed (or previously applied) patch detected! Assume -R? [y] y
> patching file 'src/image/version_images.c'
> Reversed (or previously applied) patch detected! Assume -R? [y] y
> patching file 'src/ttf/version_ttf.c'
> Reversed (or previously applied) patch detected! Assume -R? [y] y
>
> Attempting to build:
>
> make SDL_PLATFORM=macos_ports SDL_MODE=release
> mkdir -p gen/src/
> gprbuild -p -gnat2012 -XSDL_MODE=release -XSDL_PLATFORM=macos_ports \
> -Psdlada.gpr
> Setup
> [mkdir] object directory for project SDLAda
> sdlada.gpr:1:17: warning: Linker switches not taken into account in library projects
> sdlada.gpr:30:39: "../../src/macos_ports" is not a valid directory
> gprbuild: "sdlada.gpr" processing failed
> make: *** [lib/libadasdl.a] Error 5
> So, what did I do wrong this time?
>
> Thanks,
> Ken
Ok,
I deleted the contents of the sdlada git clone directory...
then did a git restore .
then applied the patch
then ran make.
Still fails...
*****************************************************************
patch -p1 < test.patch
patching file 'build/gnat/makefile'
patching file 'build/gnat/sdlada.gpr'
patching file 'build/gnat/sdlada_image.gpr'
patching file 'build/gnat/tests.gpr'
patching file 'build/gnat/tests_image.gpr'
patching file 'build/gnat/unit_tests.gpr'
patching file 'src/image/version_images.c'
patching file 'src/ttf/version_ttf.c'
sdlada: cd build/gnat
gnat: make SDL_PLATFORM=macos_ports SDL_MODE=release
mkdir -p gen/src/
gprbuild -p -gnat2012 -XSDL_MODE=release -XSDL_PLATFORM=macos_ports \
-Ptools.gpr
Setup
[mkdir] object directory for project Tools
Compile
[Ada] gen_keyboard.adb
[Ada] scancodes.ads
[Ada] utils.adb
Bind
[gprbind] gen_keyboard.bexch
[Ada] gen_keyboard.ali
Link
[link] gen_keyboard.adb
./gen/release/tools/gen_keyboard > gen/src/sdl-events-keyboards.ads
gprbuild -p -gnat2012 -XSDL_MODE=release -XSDL_PLATFORM=macos_ports \
-Psdlada.gpr
Setup
[mkdir] object directory for project SDLAda
sdlada.gpr:1:17: warning: Linker switches not taken into account in library projects
sdlada.gpr:30:39: "../../src/macos_ports" is not a valid directory
gprbuild: "sdlada.gpr" processing failed
make: *** [lib/libadasdl.a] Error 5
*****************************************************************
Thanks,
Ken
On Thursday, July 6, 2023 at 6:25:42 PM UTC-7, Kenneth Wolcott wrote:
> On Thursday, July 6, 2023 at 6:23:51 PM UTC-7, Kenneth Wolcott wrote:
> > On Thursday, July 6, 2023 at 12:37:20 PM UTC-7, Kenneth Wolcott wrote:
> > > On Tuesday, July 4, 2023 at 2:00:11 AM UTC-7, Luke A. Guest wrote:
> > > > On 04/07/2023 00:58, Kenneth Wolcott wrote:
> > > > > On Monday, July 3, 2023 at 4:24:37 PM UTC-7, Keith Thompson wrote:
> > > > >> Kenneth Wolcott writes:
> > > > >> [...]
> > > > >>> After adding a semi-colon at the following line in sdlada.gpr
> > > > >>>
> > > > >>> for Default_Swiches ("Ada") use ("-gnat202", "-gnata");
> > > > >> [...]
> > > > >>
> > > > >> Unless "-gnat202" requests the version of Ada that was current during
> > > > >> the reign of Septimius Severus, you probably want to use "-gnat2022".
> > > > >> (Options can be abbreviated, but "-gnat202" may become ambiguous if
> > > > >> there's a new Ada standard before 2030.)
> > > > >>
> > > > >> Also "Default_Swiches" is mispelled.
> > > > >>
> > > > >> If the typos are the result of re-typing that line, I strongly suggest
> > > > >> copy-and-pasting any code you post.
> > > > >>
> > > > >> --
> > > > >> Keith Thompson
> > > > >
> > > > > Thank you, Keith :-)
> > > > >
> > > > > Fixed those two typos.
> > > > >
> > > > > Here's the current output from trying to build:
> > > > >
> > > > > make SDL_PLATFORM=macos_ports SDL_MODE=debug
> > > > > mkdir -p gen/src/
> > > > > gprbuild -p -gnat2012 -XSDL_MODE=debug -XSDL_PLATFORM=macos_ports \
> > > > > -Psdlada.gpr
> > > > > sdlada.gpr:26:09: a variable cannot be declared for the first time here
> > > > > sdlada.gpr:26:23: unknown variable "C_Switches"
> > > > > gprbuild: "sdlada.gpr" processing failed
> > > > > make: *** [lib/libadasdl.a] Error 5
> > > > >
> > > > > Thanks,
> > > > > Ken
> > > > This makes no sense, line 26 is this:
> > > > Source_Platform := "../../src/" & Platform;
> > > Hi Luke;
> > >
> > > Is it possible for us to arrange a process to send the patch to me in another means? If Google Groups blocks attachments and I'm getting massively confused with the content being pasted inside the posting, we need to derive another means of communicating. I can share a different email address which is already being heavily spammed...
> > >
> > > Thanks,
> > > Ken
> > Hi Luke;
> >
> > Please email the patch to me as an attachment using the email address: [redacted :-) ]
> >
> > Please also provide a checksum of some kind so I know that the file didn't get corrupted en-route.
> >
> > Thanks,
> > Ken
> The email address is kwolcott at yahoo dot com.
Hi Luke;
Thanks for the patch via email.
The md5sum matches...
I ran git restore in the sdlada git clone directory...
I then applied the patch:
patch -p1 < test.patch
patching file 'build/gnat/makefile'
patching file 'build/gnat/sdlada.gpr'
patching file 'build/gnat/sdlada_image.gpr'
Reversed (or previously applied) patch detected! Assume -R? [y] y
patching file 'build/gnat/tests.gpr'
Reversed (or previously applied) patch detected! Assume -R? [y] y
patching file 'build/gnat/tests_image.gpr'
Reversed (or previously applied) patch detected! Assume -R? [y] y
patching file 'build/gnat/unit_tests.gpr'
Reversed (or previously applied) patch detected! Assume -R? [y] y
patching file 'src/image/version_images.c'
Reversed (or previously applied) patch detected! Assume -R? [y] y
patching file 'src/ttf/version_ttf.c'
Reversed (or previously applied) patch detected! Assume -R? [y] y
Attempting to build:
make SDL_PLATFORM=macos_ports SDL_MODE=release
mkdir -p gen/src/
gprbuild -p -gnat2012 -XSDL_MODE=release -XSDL_PLATFORM=macos_ports \
-Psdlada.gpr
Setup
[mkdir] object directory for project SDLAda
sdlada.gpr:1:17: warning: Linker switches not taken into account in library projects
sdlada.gpr:30:39: "../../src/macos_ports" is not a valid directory
gprbuild: "sdlada.gpr" processing failed
make: *** [lib/libadasdl.a] Error 5
So, what did I do wrong this time?
Thanks,
Ken
Glug ... I jumped the gun a bit. There is a security issue to be resolved. The above link will not show the full details til then. I'll re-post when the problem is fixed.
Hello.all, Unfortunately, the attempt to have gprbuild and xmlada added into the official Archlinux package repositories has not been successful. Nonetheless, thanks to those who voted for these packages. The gist of the problem from Arch's Trusted Users (who manage adding new packages into the official repo's) was "I don't use Ada, so I won't sponsor it.". Given this situation, I've created a custom repository for the (50 odd) Arch Ada packages, currently served by a Linode. Details (and the current package list) can be found here ... https://wiki.archlinux.org/title/Ada If anyone has any suggestions for additional Ada projects to add to the package list, please let me know. Regards.
"Simon Wright" <simon@pushface.org> wrote in message
news:lyr0prq19e.fsf@pushface.org...
...
> I don't know whether the ARM requires/expects Big_Integer to be
> streamable, but I think you had every reason to expect it!
See 13.13.1(54/1):
For every subtype S of a language-defined nonlimited specific type T, the
output generated by S'Output or S'Write shall be readable by S'Input or
S'Read, respectively. This rule applies across partitions if the
implementation conforms to the Distributed Systems Annex.
Ada.Numerics.Big_Numbers.Big_Integers.Big_integer surely is a
language-defined nonlimited specific type, so the above applies. Streaming
should work, if it doesn't, that's a bug.
Randy.
On Thursday, July 6, 2023 at 6:23:51 PM UTC-7, Kenneth Wolcott wrote:
> On Thursday, July 6, 2023 at 12:37:20 PM UTC-7, Kenneth Wolcott wrote:
> > On Tuesday, July 4, 2023 at 2:00:11 AM UTC-7, Luke A. Guest wrote:
> > > On 04/07/2023 00:58, Kenneth Wolcott wrote:
> > > > On Monday, July 3, 2023 at 4:24:37 PM UTC-7, Keith Thompson wrote:
> > > >> Kenneth Wolcott writes:
> > > >> [...]
> > > >>> After adding a semi-colon at the following line in sdlada.gpr
> > > >>>
> > > >>> for Default_Swiches ("Ada") use ("-gnat202", "-gnata");
> > > >> [...]
> > > >>
> > > >> Unless "-gnat202" requests the version of Ada that was current during
> > > >> the reign of Septimius Severus, you probably want to use "-gnat2022".
> > > >> (Options can be abbreviated, but "-gnat202" may become ambiguous if
> > > >> there's a new Ada standard before 2030.)
> > > >>
> > > >> Also "Default_Swiches" is mispelled.
> > > >>
> > > >> If the typos are the result of re-typing that line, I strongly suggest
> > > >> copy-and-pasting any code you post.
> > > >>
> > > >> --
> > > >> Keith Thompson
> > > >
> > > > Thank you, Keith :-)
> > > >
> > > > Fixed those two typos.
> > > >
> > > > Here's the current output from trying to build:
> > > >
> > > > make SDL_PLATFORM=macos_ports SDL_MODE=debug
> > > > mkdir -p gen/src/
> > > > gprbuild -p -gnat2012 -XSDL_MODE=debug -XSDL_PLATFORM=macos_ports \
> > > > -Psdlada.gpr
> > > > sdlada.gpr:26:09: a variable cannot be declared for the first time here
> > > > sdlada.gpr:26:23: unknown variable "C_Switches"
> > > > gprbuild: "sdlada.gpr" processing failed
> > > > make: *** [lib/libadasdl.a] Error 5
> > > >
> > > > Thanks,
> > > > Ken
> > > This makes no sense, line 26 is this:
> > > Source_Platform := "../../src/" & Platform;
> > Hi Luke;
> >
> > Is it possible for us to arrange a process to send the patch to me in another means? If Google Groups blocks attachments and I'm getting massively confused with the content being pasted inside the posting, we need to derive another means of communicating. I can share a different email address which is already being heavily spammed...
> >
> > Thanks,
> > Ken
> Hi Luke;
>
> Please email the patch to me as an attachment using the email address: kwol...@yahoo.com...
>
> Please also provide a checksum of some kind so I know that the file didn't get corrupted en-route.
>
> Thanks,
> Ken
The email address is kwolcott at yahoo dot com.
On Thursday, July 6, 2023 at 12:37:20 PM UTC-7, Kenneth Wolcott wrote:
> On Tuesday, July 4, 2023 at 2:00:11 AM UTC-7, Luke A. Guest wrote:
> > On 04/07/2023 00:58, Kenneth Wolcott wrote:
> > > On Monday, July 3, 2023 at 4:24:37 PM UTC-7, Keith Thompson wrote:
> > >> Kenneth Wolcott writes:
> > >> [...]
> > >>> After adding a semi-colon at the following line in sdlada.gpr
> > >>>
> > >>> for Default_Swiches ("Ada") use ("-gnat202", "-gnata");
> > >> [...]
> > >>
> > >> Unless "-gnat202" requests the version of Ada that was current during
> > >> the reign of Septimius Severus, you probably want to use "-gnat2022".
> > >> (Options can be abbreviated, but "-gnat202" may become ambiguous if
> > >> there's a new Ada standard before 2030.)
> > >>
> > >> Also "Default_Swiches" is mispelled.
> > >>
> > >> If the typos are the result of re-typing that line, I strongly suggest
> > >> copy-and-pasting any code you post.
> > >>
> > >> --
> > >> Keith Thompson
> > >
> > > Thank you, Keith :-)
> > >
> > > Fixed those two typos.
> > >
> > > Here's the current output from trying to build:
> > >
> > > make SDL_PLATFORM=macos_ports SDL_MODE=debug
> > > mkdir -p gen/src/
> > > gprbuild -p -gnat2012 -XSDL_MODE=debug -XSDL_PLATFORM=macos_ports \
> > > -Psdlada.gpr
> > > sdlada.gpr:26:09: a variable cannot be declared for the first time here
> > > sdlada.gpr:26:23: unknown variable "C_Switches"
> > > gprbuild: "sdlada.gpr" processing failed
> > > make: *** [lib/libadasdl.a] Error 5
> > >
> > > Thanks,
> > > Ken
> > This makes no sense, line 26 is this:
> > Source_Platform := "../../src/" & Platform;
> Hi Luke;
>
> Is it possible for us to arrange a process to send the patch to me in another means? If Google Groups blocks attachments and I'm getting massively confused with the content being pasted inside the posting, we need to derive another means of communicating. I can share a different email address which is already being heavily spammed...
>
> Thanks,
> Ken
Hi Luke;
Please email the patch to me as an attachment using the email address: kwolcott@yahoo.com...
Please also provide a checksum of some kind so I know that the file didn't get corrupted en-route.
Thanks,
Ken
On Tuesday, July 4, 2023 at 2:00:11 AM UTC-7, Luke A. Guest wrote:
> On 04/07/2023 00:58, Kenneth Wolcott wrote:
> > On Monday, July 3, 2023 at 4:24:37 PM UTC-7, Keith Thompson wrote:
> >> Kenneth Wolcott writes:
> >> [...]
> >>> After adding a semi-colon at the following line in sdlada.gpr
> >>>
> >>> for Default_Swiches ("Ada") use ("-gnat202", "-gnata");
> >> [...]
> >>
> >> Unless "-gnat202" requests the version of Ada that was current during
> >> the reign of Septimius Severus, you probably want to use "-gnat2022".
> >> (Options can be abbreviated, but "-gnat202" may become ambiguous if
> >> there's a new Ada standard before 2030.)
> >>
> >> Also "Default_Swiches" is mispelled.
> >>
> >> If the typos are the result of re-typing that line, I strongly suggest
> >> copy-and-pasting any code you post.
> >>
> >> --
> >> Keith Thompson
> >
> > Thank you, Keith :-)
> >
> > Fixed those two typos.
> >
> > Here's the current output from trying to build:
> >
> > make SDL_PLATFORM=macos_ports SDL_MODE=debug
> > mkdir -p gen/src/
> > gprbuild -p -gnat2012 -XSDL_MODE=debug -XSDL_PLATFORM=macos_ports \
> > -Psdlada.gpr
> > sdlada.gpr:26:09: a variable cannot be declared for the first time here
> > sdlada.gpr:26:23: unknown variable "C_Switches"
> > gprbuild: "sdlada.gpr" processing failed
> > make: *** [lib/libadasdl.a] Error 5
> >
> > Thanks,
> > Ken
> This makes no sense, line 26 is this:
> Source_Platform := "../../src/" & Platform;
Hi Luke;
Is it possible for us to arrange a process to send the patch to me in another means? If Google Groups blocks attachments and I'm getting massively confused with the content being pasted inside the posting, we need to derive another means of communicating. I can share a different email address which is already being heavily spammed...
Thanks,
Ken
On 04/07/2023 14:39, Dmitry A. Kazakov wrote: > On 2023-07-04 12:56, magardner2010 wrote: > >> ... > > You never defined the protocol and implemented it in the first place. > You used some code generation tools which, if ever worked, will bite you > in the end. With regards to the code generation tool (which I'm assuming refers to chtGPT, for which I don't have enough creatively insulting backronyms), I spent a good half a day getting the output to actually be accepted by rpcgen. I then rewrote most of it from scratch. With regards to the protocol implementation, I would like to point at the function that begins at https://github.com/smeagolthellama/szakdolgozat-notes/blob/f0b5143855f75354d41509845b0a41f0902d2928/ada/src/network_tree.adb#L29 , which has successfully communicated with other instances of itself, albeit using 'write and 'read to handle anything more complicated than "is the first character of the message a '?', a 'j', or a '>'?". My question was about how to get C to understand the language Ada is talking to itself in, given that that language should be at least related to XDR. > > To summarize the problem. The stream attribute 'Write writes the > constrained object. 'Output adds the constraints. Ada is capable to have > variable length records. C cannot do this. In short, it means that XDR's > discriminated union can be mapped onto Ada's variant record with no > default discriminant, but it cannot be directly mapped onto C's union. I > presume that GNAT implements XDR correctly and the C side does not cope. > I'm not sure I understand what you're saying here. Given that rpcgen (which generates functions for xdr, as well as rpc, a superset thereof) was a part of GNU's libc for a while, and still is on some ubuntu boxes, along with the fact that a number of Linux's favourite protocols (such as NFS) are implemented using it, I don't think the issue is the C side implementing the encoder/decoder in a way that doesn't match my spec. I expect either an Ada issue, a spec issue, or both. > Which is one of thousand reasons not to implement a communication > protocol by deriving representation from some language objects. Cutting > corners will not help you. I suppose there is wisdom in that, especially when attempting to communicate across architectures, but I was working under the assumption that the -xdr flag would remove the issue, as XDR is an architecture-and-programming-language-agnostic data encoding/decoding standard (or whatever an RFC counts as). > > Define the (application level [*]) protocol. Implement it in Ada. > Implement it in C. Done. > > --------------------- > * XDR or ASN.1 or whatever are not application level! > I wouldn't have called XDR a protocol in the first place, except as a simplification. I would like to use it as a *part* of my protocol, not dissimilar to how NFS does, or programs that use G*ogle's protobuf thingie. Specifically, when a peer receives a query (in the form of a message starting with '?'), it should respond with a lump of data (current idea is the Child_Set type from my previous post, encoded in the XDR format, hence the difficulties) saying how many peers it has (in range 0..2), and who they are (address-port combinations, where address can be IPv4 or 6), so that the querying party can find out if there is space for it on this peer, or if it should look elsewhere. There are a couple of edge cases, but this if you are curious you can look at my code.
On 2023-07-04 12:56, magardner2010 wrote: > However, if the ada code encodes the object with 'write, then it creates > something about 4 bytes too short, and if I use 'output, it is parsed as > starting with family_type 256, which is not a member of the enum. Given > that the gnat documentation for the -xdr flag is literally two lines, I > don't really know where to look for more information on what I'm doing > wrong. You never defined the protocol and implemented it in the first place. You used some code generation tools which, if ever worked, will bite you in the end. To summarize the problem. The stream attribute 'Write writes the constrained object. 'Output adds the constraints. Ada is capable to have variable length records. C cannot do this. In short, it means that XDR's discriminated union can be mapped onto Ada's variant record with no default discriminant, but it cannot be directly mapped onto C's union. I presume that GNAT implements XDR correctly and the C side does not cope. Which is one of thousand reasons not to implement a communication protocol by deriving representation from some language objects. Cutting corners will not help you. Define the (application level [*]) protocol. Implement it in Ada. Implement it in C. Done. --------------------- * XDR or ASN.1 or whatever are not application level! -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
I'm still working on the p2p one-to-many data streaming protocol thing (at https://github.com/smeagolthellama/szakdolgozat-notes/tree/main/ada) and I'm trying to get it to communicate with a C thing via the xdr protocol. I'm trying to transfer a Child_Set, where ``` type Child_Number is range 0 .. 2; subtype Child_Index is Child_Number range 1 .. Child_Number'Last; type Child_Set is array (Child_Index) of GNAT.Sockets.Sock_Addr_Type; ``` With the help of chatGPT, I wrote the following xdr spec file: ``` const CHILD_NUMBER = 2; typedef unsigned int uint32; typedef unsigned char uint8; enum family_type { FAMILY_INET = 0, FAMILY_INET6 = 1, FAMILY_UNIX = 2, FAMILY_UNSPEC = 3 }; union inet_addr_type switch (family_type family) { case FAMILY_INET: opaque sin_v4[4]; case FAMILY_INET6: opaque sin_v6[16]; default: void; }; struct address_and_port{ inet_addr_type addr; unsigned int port; }; union sock_addr_type switch (family_type family) { case FAMILY_UNIX: string name<>; case FAMILY_INET: address_and_port anp4; case FAMILY_INET6: address_and_port anp6; case FAMILY_UNSPEC: void; }; struct child_set { sock_addr_type child_set_array[CHILD_NUMBER]; }; ``` and using rpcgen, generated a C thing to encode/decode the messages the ada program is sending. However, if the ada code encodes the object with 'write, then it creates something about 4 bytes too short, and if I use 'output, it is parsed as starting with family_type 256, which is not a member of the enum. Given that the gnat documentation for the -xdr flag is literally two lines, I don't really know where to look for more information on what I'm doing wrong. My current hypotheses include the C code having the family type recorded too many times (but I don't know how to check or fix that in the .x file) or the ada code not encoding the data according to the xdr standard correctly (but I am using the flag, and neither 'write or 'output fixes it).
On 04/07/2023 00:58, Kenneth Wolcott wrote:
> On Monday, July 3, 2023 at 4:24:37 PM UTC-7, Keith Thompson wrote:
>> Kenneth Wolcott writes:
>> [...]
>>> After adding a semi-colon at the following line in sdlada.gpr
>>>
>>> for Default_Swiches ("Ada") use ("-gnat202", "-gnata");
>> [...]
>>
>> Unless "-gnat202" requests the version of Ada that was current during
>> the reign of Septimius Severus, you probably want to use "-gnat2022".
>> (Options can be abbreviated, but "-gnat202" may become ambiguous if
>> there's a new Ada standard before 2030.)
>>
>> Also "Default_Swiches" is mispelled.
>>
>> If the typos are the result of re-typing that line, I strongly suggest
>> copy-and-pasting any code you post.
>>
>> --
>> Keith Thompson
>
> Thank you, Keith :-)
>
> Fixed those two typos.
>
> Here's the current output from trying to build:
>
> make SDL_PLATFORM=macos_ports SDL_MODE=debug
> mkdir -p gen/src/
> gprbuild -p -gnat2012 -XSDL_MODE=debug -XSDL_PLATFORM=macos_ports \
> -Psdlada.gpr
> sdlada.gpr:26:09: a variable cannot be declared for the first time here
> sdlada.gpr:26:23: unknown variable "C_Switches"
> gprbuild: "sdlada.gpr" processing failed
> make: *** [lib/libadasdl.a] Error 5
>
> Thanks,
> Ken
This makes no sense, line 26 is this:
Source_Platform := "../../src/" & Platform;
On 04/07/2023 00:24, Keith Thompson wrote:
> Kenneth Wolcott <kennethwolcott@gmail.com> writes:
> [...]
>> After adding a semi-colon at the following line in sdlada.gpr
>>
>> for Default_Swiches ("Ada") use ("-gnat202", "-gnata");
> [...]
>
> Unless "-gnat202" requests the version of Ada that was current during
> the reign of Septimius Severus, you probably want to use "-gnat2022".
> (Options can be abbreviated, but "-gnat202" may become ambiguous if
> there's a new Ada standard before 2030.)
>
> Also "Default_Swiches" is mispelled.
>
> If the typos are the result of re-typing that line, I strongly suggest
> copy-and-pasting any code you post.
>
I don't have that, I have "-gnat2012" see my previous post.
On 04/07/2023 00:01, Kenneth Wolcott wrote:
> ./gen/release/tools/gen_keyboard > gen/src/sdl-events-keyboards.ads
> gprbuild -p -gnat2012 -XSDL_MODE=release -XSDL_PLATFORM=macos_ports \
> -Psdlada.gpr
> sdlada.gpr:16:07: undefined attribute "default_swiches"
> sdlada.gpr:17:03: ";" after declarative items expected
> sdlada.gpr:26:09: a variable cannot be declared for the first time here
> sdlada.gpr:26:23: unknown variable "C_Switches"
> sdlada.gpr:34:08: undefined attribute "languages"
> sdlada.gpr:35:08: undefined attribute "source_dirs"
> sdlada.gpr:42:08: undefined attribute "library_name"
> sdlada.gpr:43:08: undefined attribute "object_dir"
> sdlada.gpr:44:08: undefined attribute "library_dir"
> sdlada.gpr:45:08: undefined attribute "library_kind"
> sdlada.gpr:47:04: a package cannot be declared here
> sdlada.gpr:79:04: a package cannot be declared here
> sdlada.gpr:108:05: expected "builder"
> gprbuild: "sdlada.gpr" processing failed
> make: *** [lib/libadasdl.a] Error 5
>
> Ken
I don't know what's going on about, here's the gpr I have:
library project SDLAda is
type Platform_Type is ("linux",
"bsd",
"windows",
"macosx",
"macos_homebrew",
"macos_ports",
"ios",
"android");
type Mode_Type is ("debug", "release");
Platform : Platform_Type := external ("SDL_PLATFORM", "linux");
Mode : Mode_Type := external ("SDL_MODE", "debug");
package Builder is
for Default_Switches ("Ada") use ("-gnat2012", "-gnata");
end Builder;
Source_Platform := "";
case Platform is
when "macos_homebrew" =>
Source_Platform := "../../src/macosx";
when others =>
Source_Platform := "../../src/" & Platform;
end case;
for Languages use ("Ada", "C");
for Source_Dirs use ("../../src", Source_Platform, "gen/src/",
-- For SDL.Image.
"../../src/image",
-- For SDL.TTF.
"../../src/ttf");
for Library_Name use "sdlada";
for Object_Dir use "gen/" & Mode & "/lib/.obj";
for Library_Dir use "gen/" & Mode & "/lib";
for Library_Kind use "static";
package Compiler is
Common_Switches := ("-ffunction-sections", "-fdata-sections");
C_Switches := ();
Ada_Switches := ("-gnat2012", "-gnata", "-gnato", "-gnatE",
"-gnatwa",
"-gnaty", "-gnaty-s", "-gnatyO",
"-gnatyM120", "-gnatyx");
case Mode is
when "debug" =>
Common_Switches := Common_Switches & ("-O0", "-g", "-ggdb");
when "release" =>
Common_Switches := Common_Switches & ("-O2");
end case;
-- These flags require checking on all platforms as they're
taken directly from sdl2-config.
case Platform is
when "linux" | "bsd" | "android" | "windows" =>
C_Switches := C_Switches & ("-I/usr/include/SDL2",
"-D_REENTRANT");
when "macos_homebrew" =>
C_Switches := C_Switches & ("-DSDL_HOMEBREW",
"-I/usr/local/include",
"-D_REENTRANT");
when "macos_ports" =>
C_Switches := C_Switches & ("-DSDL_MACPORTS",
"-I/opt/local/include",
"-D_THREAD_SAFE");
when others =>
null;
end case;
for Default_Switches ("C") use Common_Switches & C_Switches;
for Default_Switches ("Ada") use Common_Switches & Ada_Switches;
end Compiler;
package Linker is
Linker_Switches := ();
case Platform is
when "linux" | "bsd" | "android" | "windows" =>
Linker_Switches := Linker_Switches & ("-lSDL2",
"-lSDL2_ttf",
"-lSDL2_image",
"-L/usr/lib64");
when "macos_homebrew" =>
Linker_Switches := Linker_Switches & ("-lSDL2",
"-lSDL2_ttf",
"-lSDL2_image",
"-L/usr/local/lib");
when "macos_ports" =>
Linker_Switches := Linker_Switches & ("-lSDL2",
"-lSDL2_ttf",
"-lSDL2_image",
"-L/opt/local/lib");
when others =>
null;
end case;
for Switches ("Ada") use Linker_Switches;
end Linker;
end SDLAda;
On 1/7/23 17:36, Blady wrote: > > Hello Rod, > > Thanks for sharing, I'll take a look. > > I'm building GnatStudio for macOS Ventura. > Currently at step Ada Language Server, next to the step GnatStudio > itself ;-) > > I'll be sure to share my progress. Hi Pascal, How is the Ventura build going ? If anything in the 'cookbook' is unclear or problematic, don't hesitate to ask. > In the meantime here is my approach for version 23.0w (in French language): > http://blady.pagesperso-orange.fr/telechargements/gnat/Install-GS-Quartz_WF.pdf > Errr, my Francais is a little rusty :) but good luck (bonne chance?) ! Regards.
On Monday, July 3, 2023 at 4:24:37 PM UTC-7, Keith Thompson wrote:
> Kenneth Wolcott writes:
> [...]
> > After adding a semi-colon at the following line in sdlada.gpr
> >
> > for Default_Swiches ("Ada") use ("-gnat202", "-gnata");
> [...]
>
> Unless "-gnat202" requests the version of Ada that was current during
> the reign of Septimius Severus, you probably want to use "-gnat2022".
> (Options can be abbreviated, but "-gnat202" may become ambiguous if
> there's a new Ada standard before 2030.)
>
> Also "Default_Swiches" is mispelled.
>
> If the typos are the result of re-typing that line, I strongly suggest
> copy-and-pasting any code you post.
>
> --
> Keith Thompson
Thank you, Keith :-)
Fixed those two typos.
Here's the current output from trying to build:
make SDL_PLATFORM=macos_ports SDL_MODE=debug
mkdir -p gen/src/
gprbuild -p -gnat2012 -XSDL_MODE=debug -XSDL_PLATFORM=macos_ports \
-Psdlada.gpr
sdlada.gpr:26:09: a variable cannot be declared for the first time here
sdlada.gpr:26:23: unknown variable "C_Switches"
gprbuild: "sdlada.gpr" processing failed
make: *** [lib/libadasdl.a] Error 5
Thanks,
Ken
Kenneth Wolcott <kennethwolcott@gmail.com> writes:
[...]
> After adding a semi-colon at the following line in sdlada.gpr
>
> for Default_Swiches ("Ada") use ("-gnat202", "-gnata");
[...]
Unless "-gnat202" requests the version of Ada that was current during
the reign of Septimius Severus, you probably want to use "-gnat2022".
(Options can be abbreviated, but "-gnat202" may become ambiguous if
there's a new Ada standard before 2030.)
Also "Default_Swiches" is mispelled.
If the typos are the result of re-typing that line, I strongly suggest
copy-and-pasting any code you post.
--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */
On Monday, July 3, 2023 at 4:01:44 PM UTC-7, Kenneth Wolcott wrote:
> On Monday, July 3, 2023 at 3:56:27 PM UTC-7, Kenneth Wolcott wrote:
> > On Monday, July 3, 2023 at 1:11:29 PM UTC-7, Luke A. Guest wrote:
> > > On 03/07/2023 20:58, Kenneth Wolcott wrote:
> > > > I don't think that downloading the zip file from GitHub would be any different than doing the git clone, but
> > > Just clone it.
> > Hi Luke;
> >
> > I've cloned the package.
> >
> > I've manually applied the patch to the cloned package.
> >
> > I'm about to build it now (fingers crossed).
> >
> > Thanks,
> > Ken
> Well, I must have made one or more mistakes in the manual patching of the files (*SIGH*)
>
> make SDL_PLATFORM=macos_ports SDL_MODE=release
> mkdir -p gen/src/
> gprbuild -p -gnat2012 -XSDL_MODE=release -XSDL_PLATFORM=macos_ports \
> -Ptools.gpr
> Setup
> [mkdir] object directory for project Tools
> Compile
> [Ada] gen_keyboard.adb
> [Ada] scancodes.ads
> [Ada] utils.adb
> Bind
> [gprbind] gen_keyboard.bexch
> [Ada] gen_keyboard.ali
> Link
> [link] gen_keyboard.adb
> ./gen/release/tools/gen_keyboard > gen/src/sdl-events-keyboards.ads
> gprbuild -p -gnat2012 -XSDL_MODE=release -XSDL_PLATFORM=macos_ports \
> -Psdlada.gpr
> sdlada.gpr:16:07: undefined attribute "default_swiches"
> sdlada.gpr:17:03: ";" after declarative items expected
> sdlada.gpr:26:09: a variable cannot be declared for the first time here
> sdlada.gpr:26:23: unknown variable "C_Switches"
> sdlada.gpr:34:08: undefined attribute "languages"
> sdlada.gpr:35:08: undefined attribute "source_dirs"
> sdlada.gpr:42:08: undefined attribute "library_name"
> sdlada.gpr:43:08: undefined attribute "object_dir"
> sdlada.gpr:44:08: undefined attribute "library_dir"
> sdlada.gpr:45:08: undefined attribute "library_kind"
> sdlada.gpr:47:04: a package cannot be declared here
> sdlada.gpr:79:04: a package cannot be declared here
> sdlada.gpr:108:05: expected "builder"
> gprbuild: "sdlada.gpr" processing failed
> make: *** [lib/libadasdl.a] Error 5
>
> Ken
After adding a semi-colon at the following line in sdlada.gpr
for Default_Swiches ("Ada") use ("-gnat202", "-gnata");
We have the following when trying to make again:
make SDL_PLATFORM=macos_ports SDL_MODE=debug
mkdir -p gen/src/
gprbuild -p -gnat2012 -XSDL_MODE=debug -XSDL_PLATFORM=macos_ports \
-Ptools.gpr
Setup
[mkdir] object directory for project Tools
Compile
[Ada] gen_keyboard.adb
[Ada] scancodes.ads
[Ada] utils.adb
Bind
[gprbind] gen_keyboard.bexch
[Ada] gen_keyboard.ali
Link
[link] gen_keyboard.adb
./gen/debug/tools/gen_keyboard > gen/src/sdl-events-keyboards.ads
gprbuild -p -gnat2012 -XSDL_MODE=debug -XSDL_PLATFORM=macos_ports \
-Psdlada.gpr
sdlada.gpr:16:07: undefined attribute "default_swiches"
sdlada.gpr:26:09: a variable cannot be declared for the first time here
sdlada.gpr:26:23: unknown variable "C_Switches"
gprbuild: "sdlada.gpr" processing failed
make: *** [lib/libadasdl.a] Error 5
I hope that this shows that I made mistake(s) that can be shown to me that I can fix or that this is clear regarding what still needs to be done for the SDLAda port to MacPorts...
Ken
On Monday, July 3, 2023 at 3:56:27 PM UTC-7, Kenneth Wolcott wrote:
> On Monday, July 3, 2023 at 1:11:29 PM UTC-7, Luke A. Guest wrote:
> > On 03/07/2023 20:58, Kenneth Wolcott wrote:
> > > I don't think that downloading the zip file from GitHub would be any different than doing the git clone, but
> > Just clone it.
> Hi Luke;
>
> I've cloned the package.
>
> I've manually applied the patch to the cloned package.
>
> I'm about to build it now (fingers crossed).
>
> Thanks,
> Ken
Well, I must have made one or more mistakes in the manual patching of the files (*SIGH*)
make SDL_PLATFORM=macos_ports SDL_MODE=release
mkdir -p gen/src/
gprbuild -p -gnat2012 -XSDL_MODE=release -XSDL_PLATFORM=macos_ports \
-Ptools.gpr
Setup
[mkdir] object directory for project Tools
Compile
[Ada] gen_keyboard.adb
[Ada] scancodes.ads
[Ada] utils.adb
Bind
[gprbind] gen_keyboard.bexch
[Ada] gen_keyboard.ali
Link
[link] gen_keyboard.adb
./gen/release/tools/gen_keyboard > gen/src/sdl-events-keyboards.ads
gprbuild -p -gnat2012 -XSDL_MODE=release -XSDL_PLATFORM=macos_ports \
-Psdlada.gpr
sdlada.gpr:16:07: undefined attribute "default_swiches"
sdlada.gpr:17:03: ";" after declarative items expected
sdlada.gpr:26:09: a variable cannot be declared for the first time here
sdlada.gpr:26:23: unknown variable "C_Switches"
sdlada.gpr:34:08: undefined attribute "languages"
sdlada.gpr:35:08: undefined attribute "source_dirs"
sdlada.gpr:42:08: undefined attribute "library_name"
sdlada.gpr:43:08: undefined attribute "object_dir"
sdlada.gpr:44:08: undefined attribute "library_dir"
sdlada.gpr:45:08: undefined attribute "library_kind"
sdlada.gpr:47:04: a package cannot be declared here
sdlada.gpr:79:04: a package cannot be declared here
sdlada.gpr:108:05: expected "builder"
gprbuild: "sdlada.gpr" processing failed
make: *** [lib/libadasdl.a] Error 5
Ken
On Monday, July 3, 2023 at 1:11:29 PM UTC-7, Luke A. Guest wrote:
> On 03/07/2023 20:58, Kenneth Wolcott wrote:
> > I don't think that downloading the zip file from GitHub would be any different than doing the git clone, but
> Just clone it.
Hi Luke;
I've cloned the package.
I've manually applied the patch to the cloned package.
I'm about to build it now (fingers crossed).
Thanks,
Ken
On 03/07/2023 20:58, Kenneth Wolcott wrote:
> I don't think that downloading the zip file from GitHub would be any different than doing the git clone, but
Just clone it.
On 03/07/2023 20:58, Kenneth Wolcott wrote: > Hi Luke; > > I wonder if there was an error introduced by the copy&paste with the mouse and/or with the formatting of the posting/email...I'll try to examine that specific area to see if anything shows up under a closer inspection. > > I don't think that downloading the zip file from GitHub would be any different than doing the git clone, but there's another difference that might be a cause, ever so remote. > > I'll try to get back to you with results shortly. > > Again, thanks for your efforts with regards to porting SDLADA towards MacPorts... > > Ken I used xclip -i ~/src/mine-new/game-dev/sdl/sdlada/test.patch and paste with middle mouse button, just like below, the first line should "diff...": diff --git a/build/gnat/makefile b/build/gnat/makefile index b13930f..0046490 100644 --- a/build/gnat/makefile +++ b/build/gnat/makefile @@ -90,7 +90,7 @@ tests: $(LIB_NAME) tests.gpr $(TESTS_SRCS) tests.gpr: $(TESTS_SRCS) gen/$(SDL_MODE)/test/libtestmaths.so $(GPRMAKE) -p -gnat2012 -XSDL_MODE=$(SDL_MODE) -XSDL_PLATFORM=$(SDL_PLATFORM) \ - -Ptests.gpr ${SDL2_CONFIG} + -Ptests.gpr # ${SDL2_CONFIG} # Maths library @@ -111,7 +111,7 @@ unit_tests: $(LIB_NAME) build_unit_tests/unit_tests build_unit_tests/unit_tests: $(GPRMAKE) -p -gnat2012 -XSDL_MODE=$(SDL_MODE) -XSDL_PLATFORM=$(SDL_PLATFORM) \ - -Punit_tests.gpr ${SDL2_CONFIG} + -Punit_tests.gpr # ${SDL2_CONFIG} .PHONY: clean-unit_tests diff --git a/build/gnat/sdlada.gpr b/build/gnat/sdlada.gpr index adc77f5..13ef8ee 100644 --- a/build/gnat/sdlada.gpr +++ b/build/gnat/sdlada.gpr @@ -1,10 +1,21 @@ library project SDLAda is - type Platform_Type is ("linux", "bsd", "windows", "macosx", "macos_homebrew", "ios", "android"); + type Platform_Type is ("linux", + "bsd", + "windows", + "macosx", + "macos_homebrew", + "macos_ports", + "ios", + "android"); type Mode_Type is ("debug", "release"); Platform : Platform_Type := external ("SDL_PLATFORM", "linux"); Mode : Mode_Type := external ("SDL_MODE", "debug"); + package Builder is + for Default_Switches ("Ada") use ("-gnat2012", "-gnata"); + end Builder; + Source_Platform := ""; case Platform is @@ -52,6 +63,11 @@ library project SDLAda is "-I/usr/local/include", "-D_REENTRANT"); + when "macos_ports" => + C_Switches := C_Switches & ("-DSDL_MACPORTS", + "-I/opt/local/include", + "-D_THREAD_SAFE"); + when others => null; end case; @@ -59,4 +75,33 @@ library project SDLAda is for Default_Switches ("C") use Common_Switches & C_Switches; for Default_Switches ("Ada") use Common_Switches & Ada_Switches; end Compiler; + + package Linker is + Linker_Switches := (); + + case Platform is + when "linux" | "bsd" | "android" | "windows" => + Linker_Switches := Linker_Switches & ("-lSDL2", + "-lSDL2_ttf", + "-lSDL2_image", + "-L/usr/lib64"); + + when "macos_homebrew" => + Linker_Switches := Linker_Switches & ("-lSDL2", + "-lSDL2_ttf", + "-lSDL2_image", + "-L/usr/local/lib"); + + when "macos_ports" => + Linker_Switches := Linker_Switches & ("-lSDL2", + "-lSDL2_ttf", + "-lSDL2_image", + "-L/opt/local/lib"); + + when others => + null; + end case; + + for Switches ("Ada") use Linker_Switches; + end Linker; end SDLAda; diff --git a/build/gnat/sdlada_image.gpr b/build/gnat/sdlada_image.gpr index 1098095..5a9764f 100644 --- a/build/gnat/sdlada_image.gpr +++ b/build/gnat/sdlada_image.gpr @@ -11,4 +11,5 @@ library project SDLAda_Image is for Library_Version use "libsdlada_image.so." & Version; package Compiler renames SDLAda.Compiler; + package Linker renames SDLAda.Linker; end SDLAda_Image; diff --git a/build/gnat/tests.gpr b/build/gnat/tests.gpr index 70dceff..51ee201 100644 --- a/build/gnat/tests.gpr +++ b/build/gnat/tests.gpr @@ -15,24 +15,5 @@ project Tests is "ttf.adb"); package Compiler renames SDLAda.Compiler; - - package Linker is - - Linker_Switches := (); - - case Sdlada.Platform is - when "macos_homebrew" => - Linker_Switches := Linker_Switches & ("-lSDL2", - "-lSDL2_ttf", - "-lSDL2_image", - "-L/usr/local/lib"); - - when others => - null; - end case; - - for Switches ("Ada") use Linker_Switches; - - end Linker; - + package Linker renames SDLAda.Linker; end Tests; diff --git a/build/gnat/tests_image.gpr b/build/gnat/tests_image.gpr index f23be3c..fd68309 100644 --- a/build/gnat/tests_image.gpr +++ b/build/gnat/tests_image.gpr @@ -8,6 +8,7 @@ project Tests_Image is for Main use ("load_surface.adb"); package Compiler renames SDLAda.Compiler; + package Linker renames SDLAda.Linker; -- package Builder is -- for Default_Switches ("Ada") use ("-gnat2012", "-gnata"); --, "-gnatG"); diff --git a/build/gnat/unit_tests.gpr b/build/gnat/unit_tests.gpr index c469a34..27dd38f 100644 --- a/build/gnat/unit_tests.gpr +++ b/build/gnat/unit_tests.gpr @@ -17,4 +17,5 @@ project Unit_Tests is -- end Ide; package Compiler renames SDLAda.Compiler; + package Linker renames SDLAda.Linker; end Unit_Tests; diff --git a/src/image/version_images.c b/src/image/version_images.c index ba5be68..47813a1 100644 --- a/src/image/version_images.c +++ b/src/image/version_images.c @@ -21,7 +21,7 @@ * distribution. **********************************************************************************************************************/ #ifdef __APPLE__ - #ifdef SDL_HOMEBREW + #if defined (SDL_HOMEBREW) || defined (SDL_MACPORTS) #include <SDL2/SDL_image.h> #else #include <SDL2_image/SDL_image.h> diff --git a/src/ttf/version_ttf.c b/src/ttf/version_ttf.c index cedfebc..0819103 100644 --- a/src/ttf/version_ttf.c +++ b/src/ttf/version_ttf.c @@ -21,7 +21,7 @@ * distribution. **********************************************************************************************************************/ #ifdef __APPLE__ - #ifdef SDL_HOMEBREW + #if defined (SDL_HOMEBREW) || defined (SDL_MACPORTS) #include <SDL2/SDL_ttf.h> #else #include <SDL2_ttf/SDL_ttf.h>
On Monday, July 3, 2023 at 5:23:16 AM UTC-7, Luke A. Guest wrote:
> On 02/07/2023 22:59, Kenneth Wolcott wrote:
> > On Sunday, July 2, 2023 at 2:40:15 PM UTC-7, Luke A. Guest wrote:
> >> On 02/07/2023 21:20, Kenneth Wolcott wrote:
> >>
> >>> You posted the output of running patch -p1 --dry-run < patch while inside the build/gnat directory.
> >>>
> >> No, that';s the command to test the patch on the source. To apply it you
> >> remove the dry run option.
> >>
> >> Just save the email, cut out the crap that's not the patch and then save
> >> it as test.patch as the above command should say (after the "<"), dunno
> >> what happened there.
> >
> > Thank you.
> >
> > I think saved the contents of the posting where the first diff starts as test.patch.
> >
> > I downloaded a fresh sdlada package from GitHub, calling it sdlada2.
> >
> > I then placed the test.patch file there.
> >
> > Results:
> >
> > patch -p1 --dry-run < test.patch
> > patching file 'build/gnat/makefile'
> > patch: **** malformed patch at line 7: tests.gpr: $(TESTS_SRCS) gen/$(SDL_MODE)/test/libtestmaths.so
> >
> > Did I do something wrong?
> No idea. This is what I did it with:
>
> $ git clone g...@github.com:Lucretia/sdlada.git
> Cloning into 'sdlada'...
> remote: Enumerating objects: 3100, done.
> remote: Counting objects: 100% (257/257), done.
> remote: Compressing objects: 100% (104/104), done.
> remote: Total 3100 (delta 156), reused 227 (delta 144), pack-reused 2843
> Receiving objects: 100% (3100/3100), 727.62 KiB | 303.00 KiB/s, done.
> Resolving deltas: 100% (2269/2269), done.
> $ cd sdlada/
> $ patch -p1 --dry-run < ~/src/mine-new/game-dev/sdl/sdlada/test.patch
> checking file build/gnat/makefile
> checking file build/gnat/sdlada.gpr
> checking file build/gnat/sdlada_image.gpr
> checking file build/gnat/tests.gpr
> checking file build/gnat/tests_image.gpr
> checking file build/gnat/unit_tests.gpr
> checking file src/image/version_images.c
> checking file src/ttf/version_ttf.c
Hi Luke;
I wonder if there was an error introduced by the copy&paste with the mouse and/or with the formatting of the posting/email...I'll try to examine that specific area to see if anything shows up under a closer inspection.
I don't think that downloading the zip file from GitHub would be any different than doing the git clone, but there's another difference that might be a cause, ever so remote.
I'll try to get back to you with results shortly.
Again, thanks for your efforts with regards to porting SDLADA towards MacPorts...
Ken
On 02/07/2023 22:59, Kenneth Wolcott wrote:
> On Sunday, July 2, 2023 at 2:40:15 PM UTC-7, Luke A. Guest wrote:
>> On 02/07/2023 21:20, Kenneth Wolcott wrote:
>>
>>> You posted the output of running patch -p1 --dry-run < patch while inside the build/gnat directory.
>>>
>> No, that';s the command to test the patch on the source. To apply it you
>> remove the dry run option.
>>
>> Just save the email, cut out the crap that's not the patch and then save
>> it as test.patch as the above command should say (after the "<"), dunno
>> what happened there.
>
> Thank you.
>
> I think saved the contents of the posting where the first diff starts as test.patch.
>
> I downloaded a fresh sdlada package from GitHub, calling it sdlada2.
>
> I then placed the test.patch file there.
>
> Results:
>
> patch -p1 --dry-run < test.patch
> patching file 'build/gnat/makefile'
> patch: **** malformed patch at line 7: tests.gpr: $(TESTS_SRCS) gen/$(SDL_MODE)/test/libtestmaths.so
>
> Did I do something wrong?
No idea. This is what I did it with:
$ git clone git@github.com:Lucretia/sdlada.git
Cloning into 'sdlada'...
remote: Enumerating objects: 3100, done.
remote: Counting objects: 100% (257/257), done.
remote: Compressing objects: 100% (104/104), done.
remote: Total 3100 (delta 156), reused 227 (delta 144), pack-reused 2843
Receiving objects: 100% (3100/3100), 727.62 KiB | 303.00 KiB/s, done.
Resolving deltas: 100% (2269/2269), done.
$ cd sdlada/
$ patch -p1 --dry-run < ~/src/mine-new/game-dev/sdl/sdlada/test.patch
checking file build/gnat/makefile
checking file build/gnat/sdlada.gpr
checking file build/gnat/sdlada_image.gpr
checking file build/gnat/tests.gpr
checking file build/gnat/tests_image.gpr
checking file build/gnat/unit_tests.gpr
checking file src/image/version_images.c
checking file src/ttf/version_ttf.c
On Sunday, July 2, 2023 at 2:40:15 PM UTC-7, Luke A. Guest wrote:
> On 02/07/2023 21:20, Kenneth Wolcott wrote:
>
> > You posted the output of running patch -p1 --dry-run < patch while inside the build/gnat directory.
> >
> No, that';s the command to test the patch on the source. To apply it you
> remove the dry run option.
>
> Just save the email, cut out the crap that's not the patch and then save
> it as test.patch as the above command should say (after the "<"), dunno
> what happened there.
Thank you.
I think saved the contents of the posting where the first diff starts as test.patch.
I downloaded a fresh sdlada package from GitHub, calling it sdlada2.
I then placed the test.patch file there.
Results:
patch -p1 --dry-run < test.patch
patching file 'build/gnat/makefile'
patch: **** malformed patch at line 7: tests.gpr: $(TESTS_SRCS) gen/$(SDL_MODE)/test/libtestmaths.so
Did I do something wrong?
wc -l test.patch
189 test.patch
head -1 test.patch
diff --git a/build/gnat/makefile b/build/gnat/makefile
tail -1 test.patch
#include <SDL2_ttf/SDL_ttf.h>
Thanks,
Ken
On 02/07/2023 21:20, Kenneth Wolcott wrote:
> You posted the output of running patch -p1 --dry-run < patch while inside the build/gnat directory.
>
No, that';s the command to test the patch on the source. To apply it you
remove the dry run option.
Just save the email, cut out the crap that's not the patch and then save
it as test.patch as the above command should say (after the "<"), dunno
what happened there.
On Sunday, July 2, 2023 at 1:20:25 PM UTC-7, Kenneth Wolcott wrote:
> On Sunday, July 2, 2023 at 12:52:55 PM UTC-7, Luke A. Guest wrote:
> > On 02/07/2023 20:26, Kenneth Wolcott wrote:
> >
> > >> Google Groups has suppressed Luke's two posts with attached patches.
> > >
> > > Well, that's a very logical explanation for me not seeing anything to respond to :-)
> > Friggin' goggle. It's this (within the source dir - patch --dry-run -p1
> > < test.patch):
> >
> > diff --git a/build/gnat/makefile b/build/gnat/makefile
> > index b13930f..0046490 100644
> > --- a/build/gnat/makefile
> > +++ b/build/gnat/makefile
> > @@ -90,7 +90,7 @@ tests: $(LIB_NAME) tests.gpr $(TESTS_SRCS)
> >
> > tests.gpr: $(TESTS_SRCS) gen/$(SDL_MODE)/test/libtestmaths.so
> > $(GPRMAKE) -p -gnat2012 -XSDL_MODE=$(SDL_MODE)
> > -XSDL_PLATFORM=$(SDL_PLATFORM) \
> > - -Ptests.gpr ${SDL2_CONFIG}
> > + -Ptests.gpr # ${SDL2_CONFIG}
> >
> > # Maths library
> >
> > @@ -111,7 +111,7 @@ unit_tests: $(LIB_NAME) build_unit_tests/unit_tests
> >
> > build_unit_tests/unit_tests:
> > $(GPRMAKE) -p -gnat2012 -XSDL_MODE=$(SDL_MODE)
> > -XSDL_PLATFORM=$(SDL_PLATFORM) \
> > - -Punit_tests.gpr ${SDL2_CONFIG}
> > + -Punit_tests.gpr # ${SDL2_CONFIG}
> >
> > .PHONY: clean-unit_tests
> >
> > diff --git a/build/gnat/sdlada.gpr b/build/gnat/sdlada.gpr
> > index adc77f5..13ef8ee 100644
> > --- a/build/gnat/sdlada.gpr
> > +++ b/build/gnat/sdlada.gpr
> > @@ -1,10 +1,21 @@
> > library project SDLAda is
> > - type Platform_Type is ("linux", "bsd", "windows", "macosx",
> > "macos_homebrew", "ios", "android");
> > + type Platform_Type is ("linux",
> > + "bsd",
> > + "windows",
> > + "macosx",
> > + "macos_homebrew",
> > + "macos_ports",
> > + "ios",
> > + "android");
> > type Mode_Type is ("debug", "release");
> >
> > Platform : Platform_Type := external ("SDL_PLATFORM", "linux");
> > Mode : Mode_Type := external ("SDL_MODE", "debug");
> >
> > + package Builder is
> > + for Default_Switches ("Ada") use ("-gnat2012", "-gnata");
> > + end Builder;
> > +
> > Source_Platform := "";
> >
> > case Platform is
> > @@ -52,6 +63,11 @@ library project SDLAda is
> > "-I/usr/local/include",
> > "-D_REENTRANT");
> >
> > + when "macos_ports" =>
> > + C_Switches := C_Switches & ("-DSDL_MACPORTS",
> > + "-I/opt/local/include",
> > + "-D_THREAD_SAFE");
> > +
> > when others =>
> > null;
> > end case;
> > @@ -59,4 +75,33 @@ library project SDLAda is
> > for Default_Switches ("C") use Common_Switches & C_Switches;
> > for Default_Switches ("Ada") use Common_Switches & Ada_Switches;
> > end Compiler;
> > +
> > + package Linker is
> > + Linker_Switches := ();
> > +
> > + case Platform is
> > + when "linux" | "bsd" | "android" | "windows" =>
> > + Linker_Switches := Linker_Switches & ("-lSDL2",
> > + "-lSDL2_ttf",
> > + "-lSDL2_image",
> > + "-L/usr/lib64");
> > +
> > + when "macos_homebrew" =>
> > + Linker_Switches := Linker_Switches & ("-lSDL2",
> > + "-lSDL2_ttf",
> > + "-lSDL2_image",
> > + "-L/usr/local/lib");
> > +
> > + when "macos_ports" =>
> > + Linker_Switches := Linker_Switches & ("-lSDL2",
> > + "-lSDL2_ttf",
> > + "-lSDL2_image",
> > + "-L/opt/local/lib");
> > +
> > + when others =>
> > + null;
> > + end case;
> > +
> > + for Switches ("Ada") use Linker_Switches;
> > + end Linker;
> > end SDLAda;
> > diff --git a/build/gnat/sdlada_image.gpr b/build/gnat/sdlada_image.gpr
> > index 1098095..5a9764f 100644
> > --- a/build/gnat/sdlada_image.gpr
> > +++ b/build/gnat/sdlada_image.gpr
> > @@ -11,4 +11,5 @@ library project SDLAda_Image is
> > for Library_Version use "libsdlada_image.so." & Version;
> >
> > package Compiler renames SDLAda.Compiler;
> > + package Linker renames SDLAda.Linker;
> > end SDLAda_Image;
> > diff --git a/build/gnat/tests.gpr b/build/gnat/tests.gpr
> > index 70dceff..51ee201 100644
> > --- a/build/gnat/tests.gpr
> > +++ b/build/gnat/tests.gpr
> > @@ -15,24 +15,5 @@ project Tests is
> > "ttf.adb");
> >
> > package Compiler renames SDLAda.Compiler;
> > -
> > - package Linker is
> > -
> > - Linker_Switches := ();
> > -
> > - case Sdlada.Platform is
> > - when "macos_homebrew" =>
> > - Linker_Switches := Linker_Switches & ("-lSDL2",
> > - "-lSDL2_ttf",
> > - "-lSDL2_image",
> > - "-L/usr/local/lib");
> > -
> > - when others =>
> > - null;
> > - end case;
> > -
> > - for Switches ("Ada") use Linker_Switches;
> > -
> > - end Linker;
> > -
> > + package Linker renames SDLAda.Linker;
> > end Tests;
> > diff --git a/build/gnat/tests_image.gpr b/build/gnat/tests_image.gpr
> > index f23be3c..fd68309 100644
> > --- a/build/gnat/tests_image.gpr
> > +++ b/build/gnat/tests_image.gpr
> > @@ -8,6 +8,7 @@ project Tests_Image is
> > for Main use ("load_surface.adb");
> >
> > package Compiler renames SDLAda.Compiler;
> > + package Linker renames SDLAda.Linker;
> >
> > -- package Builder is
> > -- for Default_Switches ("Ada") use ("-gnat2012", "-gnata");
> > --, "-gnatG");
> > diff --git a/build/gnat/unit_tests.gpr b/build/gnat/unit_tests.gpr
> > index c469a34..27dd38f 100644
> > --- a/build/gnat/unit_tests.gpr
> > +++ b/build/gnat/unit_tests.gpr
> > @@ -17,4 +17,5 @@ project Unit_Tests is
> > -- end Ide;
> >
> > package Compiler renames SDLAda.Compiler;
> > + package Linker renames SDLAda.Linker;
> > end Unit_Tests;
> > diff --git a/src/image/version_images.c b/src/image/version_images.c
> > index ba5be68..47813a1 100644
> > --- a/src/image/version_images.c
> > +++ b/src/image/version_images.c
> > @@ -21,7 +21,7 @@
> > * distribution.
> >
> > **********************************************************************************************************************/
> > #ifdef __APPLE__
> > - #ifdef SDL_HOMEBREW
> > + #if defined (SDL_HOMEBREW) || defined (SDL_MACPORTS)
> > #include <SDL2/SDL_image.h>
> > #else
> > #include <SDL2_image/SDL_image.h>
> > diff --git a/src/ttf/version_ttf.c b/src/ttf/version_ttf.c
> > index cedfebc..0819103 100644
> > --- a/src/ttf/version_ttf.c
> > +++ b/src/ttf/version_ttf.c
> > @@ -21,7 +21,7 @@
> > * distribution.
> >
> > **********************************************************************************************************************/
> > #ifdef __APPLE__
> > - #ifdef SDL_HOMEBREW
> > + #if defined (SDL_HOMEBREW) || defined (SDL_MACPORTS)
> > #include <SDL2/SDL_ttf.h>
> > #else
> > #include <SDL2_ttf/SDL_ttf.h>
> So, I haven't applied a patch in reverse before :-)
>
> You posted the output of running patch -p1 --dry-run < patch while inside the build/gnat directory.
>
> For the simple diffs, I can apply manually, but for the more intensive diffs, I'll probably run into trouble.
>
> So, I need the patch file (?)
>
> I save the output you posted, I manually try to implement the changes and generate a diff and see if my diff matches your diff?
>
> I guess my brain is too old here :-(
>
> Please spoon-feed me here (*SIGH*)
>
> I really appreciate the work you've put in to try to make this SDLAda package work under MacPorts...
>
> Thanks,
> Ken
Hi Luke;
I'm in the midst of applying the diffs manually.
Thanks,
Ken
On Sunday, July 2, 2023 at 12:52:55 PM UTC-7, Luke A. Guest wrote:
> On 02/07/2023 20:26, Kenneth Wolcott wrote:
>
> >> Google Groups has suppressed Luke's two posts with attached patches.
> >
> > Well, that's a very logical explanation for me not seeing anything to respond to :-)
> Friggin' goggle. It's this (within the source dir - patch --dry-run -p1
> < test.patch):
>
> diff --git a/build/gnat/makefile b/build/gnat/makefile
> index b13930f..0046490 100644
> --- a/build/gnat/makefile
> +++ b/build/gnat/makefile
> @@ -90,7 +90,7 @@ tests: $(LIB_NAME) tests.gpr $(TESTS_SRCS)
>
> tests.gpr: $(TESTS_SRCS) gen/$(SDL_MODE)/test/libtestmaths.so
> $(GPRMAKE) -p -gnat2012 -XSDL_MODE=$(SDL_MODE)
> -XSDL_PLATFORM=$(SDL_PLATFORM) \
> - -Ptests.gpr ${SDL2_CONFIG}
> + -Ptests.gpr # ${SDL2_CONFIG}
>
> # Maths library
>
> @@ -111,7 +111,7 @@ unit_tests: $(LIB_NAME) build_unit_tests/unit_tests
>
> build_unit_tests/unit_tests:
> $(GPRMAKE) -p -gnat2012 -XSDL_MODE=$(SDL_MODE)
> -XSDL_PLATFORM=$(SDL_PLATFORM) \
> - -Punit_tests.gpr ${SDL2_CONFIG}
> + -Punit_tests.gpr # ${SDL2_CONFIG}
>
> .PHONY: clean-unit_tests
>
> diff --git a/build/gnat/sdlada.gpr b/build/gnat/sdlada.gpr
> index adc77f5..13ef8ee 100644
> --- a/build/gnat/sdlada.gpr
> +++ b/build/gnat/sdlada.gpr
> @@ -1,10 +1,21 @@
> library project SDLAda is
> - type Platform_Type is ("linux", "bsd", "windows", "macosx",
> "macos_homebrew", "ios", "android");
> + type Platform_Type is ("linux",
> + "bsd",
> + "windows",
> + "macosx",
> + "macos_homebrew",
> + "macos_ports",
> + "ios",
> + "android");
> type Mode_Type is ("debug", "release");
>
> Platform : Platform_Type := external ("SDL_PLATFORM", "linux");
> Mode : Mode_Type := external ("SDL_MODE", "debug");
>
> + package Builder is
> + for Default_Switches ("Ada") use ("-gnat2012", "-gnata");
> + end Builder;
> +
> Source_Platform := "";
>
> case Platform is
> @@ -52,6 +63,11 @@ library project SDLAda is
> "-I/usr/local/include",
> "-D_REENTRANT");
>
> + when "macos_ports" =>
> + C_Switches := C_Switches & ("-DSDL_MACPORTS",
> + "-I/opt/local/include",
> + "-D_THREAD_SAFE");
> +
> when others =>
> null;
> end case;
> @@ -59,4 +75,33 @@ library project SDLAda is
> for Default_Switches ("C") use Common_Switches & C_Switches;
> for Default_Switches ("Ada") use Common_Switches & Ada_Switches;
> end Compiler;
> +
> + package Linker is
> + Linker_Switches := ();
> +
> + case Platform is
> + when "linux" | "bsd" | "android" | "windows" =>
> + Linker_Switches := Linker_Switches & ("-lSDL2",
> + "-lSDL2_ttf",
> + "-lSDL2_image",
> + "-L/usr/lib64");
> +
> + when "macos_homebrew" =>
> + Linker_Switches := Linker_Switches & ("-lSDL2",
> + "-lSDL2_ttf",
> + "-lSDL2_image",
> + "-L/usr/local/lib");
> +
> + when "macos_ports" =>
> + Linker_Switches := Linker_Switches & ("-lSDL2",
> + "-lSDL2_ttf",
> + "-lSDL2_image",
> + "-L/opt/local/lib");
> +
> + when others =>
> + null;
> + end case;
> +
> + for Switches ("Ada") use Linker_Switches;
> + end Linker;
> end SDLAda;
> diff --git a/build/gnat/sdlada_image.gpr b/build/gnat/sdlada_image.gpr
> index 1098095..5a9764f 100644
> --- a/build/gnat/sdlada_image.gpr
> +++ b/build/gnat/sdlada_image.gpr
> @@ -11,4 +11,5 @@ library project SDLAda_Image is
> for Library_Version use "libsdlada_image.so." & Version;
>
> package Compiler renames SDLAda.Compiler;
> + package Linker renames SDLAda.Linker;
> end SDLAda_Image;
> diff --git a/build/gnat/tests.gpr b/build/gnat/tests.gpr
> index 70dceff..51ee201 100644
> --- a/build/gnat/tests.gpr
> +++ b/build/gnat/tests.gpr
> @@ -15,24 +15,5 @@ project Tests is
> "ttf.adb");
>
> package Compiler renames SDLAda.Compiler;
> -
> - package Linker is
> -
> - Linker_Switches := ();
> -
> - case Sdlada.Platform is
> - when "macos_homebrew" =>
> - Linker_Switches := Linker_Switches & ("-lSDL2",
> - "-lSDL2_ttf",
> - "-lSDL2_image",
> - "-L/usr/local/lib");
> -
> - when others =>
> - null;
> - end case;
> -
> - for Switches ("Ada") use Linker_Switches;
> -
> - end Linker;
> -
> + package Linker renames SDLAda.Linker;
> end Tests;
> diff --git a/build/gnat/tests_image.gpr b/build/gnat/tests_image.gpr
> index f23be3c..fd68309 100644
> --- a/build/gnat/tests_image.gpr
> +++ b/build/gnat/tests_image.gpr
> @@ -8,6 +8,7 @@ project Tests_Image is
> for Main use ("load_surface.adb");
>
> package Compiler renames SDLAda.Compiler;
> + package Linker renames SDLAda.Linker;
>
> -- package Builder is
> -- for Default_Switches ("Ada") use ("-gnat2012", "-gnata");
> --, "-gnatG");
> diff --git a/build/gnat/unit_tests.gpr b/build/gnat/unit_tests.gpr
> index c469a34..27dd38f 100644
> --- a/build/gnat/unit_tests.gpr
> +++ b/build/gnat/unit_tests.gpr
> @@ -17,4 +17,5 @@ project Unit_Tests is
> -- end Ide;
>
> package Compiler renames SDLAda.Compiler;
> + package Linker renames SDLAda.Linker;
> end Unit_Tests;
> diff --git a/src/image/version_images.c b/src/image/version_images.c
> index ba5be68..47813a1 100644
> --- a/src/image/version_images.c
> +++ b/src/image/version_images.c
> @@ -21,7 +21,7 @@
> * distribution.
>
> **********************************************************************************************************************/
> #ifdef __APPLE__
> - #ifdef SDL_HOMEBREW
> + #if defined (SDL_HOMEBREW) || defined (SDL_MACPORTS)
> #include <SDL2/SDL_image.h>
> #else
> #include <SDL2_image/SDL_image.h>
> diff --git a/src/ttf/version_ttf.c b/src/ttf/version_ttf.c
> index cedfebc..0819103 100644
> --- a/src/ttf/version_ttf.c
> +++ b/src/ttf/version_ttf.c
> @@ -21,7 +21,7 @@
> * distribution.
>
> **********************************************************************************************************************/
> #ifdef __APPLE__
> - #ifdef SDL_HOMEBREW
> + #if defined (SDL_HOMEBREW) || defined (SDL_MACPORTS)
> #include <SDL2/SDL_ttf.h>
> #else
> #include <SDL2_ttf/SDL_ttf.h>
So, I haven't applied a patch in reverse before :-)
You posted the output of running patch -p1 --dry-run < patch while inside the build/gnat directory.
For the simple diffs, I can apply manually, but for the more intensive diffs, I'll probably run into trouble.
So, I need the patch file (?)
I save the output you posted, I manually try to implement the changes and generate a diff and see if my diff matches your diff?
I guess my brain is too old here :-(
Please spoon-feed me here (*SIGH*)
I really appreciate the work you've put in to try to make this SDLAda package work under MacPorts...
Thanks,
Ken
On 02/07/2023 20:26, Kenneth Wolcott wrote: >> Google Groups has suppressed Luke's two posts with attached patches. > > Well, that's a very logical explanation for me not seeing anything to respond to :-) Friggin' goggle. It's this (within the source dir - patch --dry-run -p1 < test.patch): diff --git a/build/gnat/makefile b/build/gnat/makefile index b13930f..0046490 100644 --- a/build/gnat/makefile +++ b/build/gnat/makefile @@ -90,7 +90,7 @@ tests: $(LIB_NAME) tests.gpr $(TESTS_SRCS) tests.gpr: $(TESTS_SRCS) gen/$(SDL_MODE)/test/libtestmaths.so $(GPRMAKE) -p -gnat2012 -XSDL_MODE=$(SDL_MODE) -XSDL_PLATFORM=$(SDL_PLATFORM) \ - -Ptests.gpr ${SDL2_CONFIG} + -Ptests.gpr # ${SDL2_CONFIG} # Maths library @@ -111,7 +111,7 @@ unit_tests: $(LIB_NAME) build_unit_tests/unit_tests build_unit_tests/unit_tests: $(GPRMAKE) -p -gnat2012 -XSDL_MODE=$(SDL_MODE) -XSDL_PLATFORM=$(SDL_PLATFORM) \ - -Punit_tests.gpr ${SDL2_CONFIG} + -Punit_tests.gpr # ${SDL2_CONFIG} .PHONY: clean-unit_tests diff --git a/build/gnat/sdlada.gpr b/build/gnat/sdlada.gpr index adc77f5..13ef8ee 100644 --- a/build/gnat/sdlada.gpr +++ b/build/gnat/sdlada.gpr @@ -1,10 +1,21 @@ library project SDLAda is - type Platform_Type is ("linux", "bsd", "windows", "macosx", "macos_homebrew", "ios", "android"); + type Platform_Type is ("linux", + "bsd", + "windows", + "macosx", + "macos_homebrew", + "macos_ports", + "ios", + "android"); type Mode_Type is ("debug", "release"); Platform : Platform_Type := external ("SDL_PLATFORM", "linux"); Mode : Mode_Type := external ("SDL_MODE", "debug"); + package Builder is + for Default_Switches ("Ada") use ("-gnat2012", "-gnata"); + end Builder; + Source_Platform := ""; case Platform is @@ -52,6 +63,11 @@ library project SDLAda is "-I/usr/local/include", "-D_REENTRANT"); + when "macos_ports" => + C_Switches := C_Switches & ("-DSDL_MACPORTS", + "-I/opt/local/include", + "-D_THREAD_SAFE"); + when others => null; end case; @@ -59,4 +75,33 @@ library project SDLAda is for Default_Switches ("C") use Common_Switches & C_Switches; for Default_Switches ("Ada") use Common_Switches & Ada_Switches; end Compiler; + + package Linker is + Linker_Switches := (); + + case Platform is + when "linux" | "bsd" | "android" | "windows" => + Linker_Switches := Linker_Switches & ("-lSDL2", + "-lSDL2_ttf", + "-lSDL2_image", + "-L/usr/lib64"); + + when "macos_homebrew" => + Linker_Switches := Linker_Switches & ("-lSDL2", + "-lSDL2_ttf", + "-lSDL2_image", + "-L/usr/local/lib"); + + when "macos_ports" => + Linker_Switches := Linker_Switches & ("-lSDL2", + "-lSDL2_ttf", + "-lSDL2_image", + "-L/opt/local/lib"); + + when others => + null; + end case; + + for Switches ("Ada") use Linker_Switches; + end Linker; end SDLAda; diff --git a/build/gnat/sdlada_image.gpr b/build/gnat/sdlada_image.gpr index 1098095..5a9764f 100644 --- a/build/gnat/sdlada_image.gpr +++ b/build/gnat/sdlada_image.gpr @@ -11,4 +11,5 @@ library project SDLAda_Image is for Library_Version use "libsdlada_image.so." & Version; package Compiler renames SDLAda.Compiler; + package Linker renames SDLAda.Linker; end SDLAda_Image; diff --git a/build/gnat/tests.gpr b/build/gnat/tests.gpr index 70dceff..51ee201 100644 --- a/build/gnat/tests.gpr +++ b/build/gnat/tests.gpr @@ -15,24 +15,5 @@ project Tests is "ttf.adb"); package Compiler renames SDLAda.Compiler; - - package Linker is - - Linker_Switches := (); - - case Sdlada.Platform is - when "macos_homebrew" => - Linker_Switches := Linker_Switches & ("-lSDL2", - "-lSDL2_ttf", - "-lSDL2_image", - "-L/usr/local/lib"); - - when others => - null; - end case; - - for Switches ("Ada") use Linker_Switches; - - end Linker; - + package Linker renames SDLAda.Linker; end Tests; diff --git a/build/gnat/tests_image.gpr b/build/gnat/tests_image.gpr index f23be3c..fd68309 100644 --- a/build/gnat/tests_image.gpr +++ b/build/gnat/tests_image.gpr @@ -8,6 +8,7 @@ project Tests_Image is for Main use ("load_surface.adb"); package Compiler renames SDLAda.Compiler; + package Linker renames SDLAda.Linker; -- package Builder is -- for Default_Switches ("Ada") use ("-gnat2012", "-gnata"); --, "-gnatG"); diff --git a/build/gnat/unit_tests.gpr b/build/gnat/unit_tests.gpr index c469a34..27dd38f 100644 --- a/build/gnat/unit_tests.gpr +++ b/build/gnat/unit_tests.gpr @@ -17,4 +17,5 @@ project Unit_Tests is -- end Ide; package Compiler renames SDLAda.Compiler; + package Linker renames SDLAda.Linker; end Unit_Tests; diff --git a/src/image/version_images.c b/src/image/version_images.c index ba5be68..47813a1 100644 --- a/src/image/version_images.c +++ b/src/image/version_images.c @@ -21,7 +21,7 @@ * distribution. **********************************************************************************************************************/ #ifdef __APPLE__ - #ifdef SDL_HOMEBREW + #if defined (SDL_HOMEBREW) || defined (SDL_MACPORTS) #include <SDL2/SDL_image.h> #else #include <SDL2_image/SDL_image.h> diff --git a/src/ttf/version_ttf.c b/src/ttf/version_ttf.c index cedfebc..0819103 100644 --- a/src/ttf/version_ttf.c +++ b/src/ttf/version_ttf.c @@ -21,7 +21,7 @@ * distribution. **********************************************************************************************************************/ #ifdef __APPLE__ - #ifdef SDL_HOMEBREW + #if defined (SDL_HOMEBREW) || defined (SDL_MACPORTS) #include <SDL2/SDL_ttf.h> #else #include <SDL2_ttf/SDL_ttf.h>
On Sunday, July 2, 2023 at 12:23:12 PM UTC-7, Simon Wright wrote:
> Kenneth Wolcott writes:
>
> > On Sunday, July 2, 2023 at 12:01:44 AM UTC-7, Luke A. Guest wrote:
> >> On 30/06/2023 14:26, Luke A. Guest wrote:
> >> > On 30/06/2023 12:30, Luke A. Guest wrote:
> >> >> The /build/gnat gpr's have got a bit confused by the looks of things.
> >> >>
> >> >> Can you try this patch, it's made from a stash from a diff branch, if
> >> >> it works I'll apply it and push it.
> >> >
> >> > Ignore that, I forgot something, try this one instead.
> >> >
> >>
> >> Hello? Did this work for you?
> >
> > Hi Luke;
> >
> > I'm not sure what you want me to try.
> >
> > I don't see an attachment. I don't see a URL. I don't see a
> > specific mention of a "patch"? on GitHub. Obviously I'm missing
> > something. Sorry I appear quite daft :-(
> >
> > Thanks,
> > Ken
> Google Groups has suppressed Luke's two posts with attached patches.
Well, that's a very logical explanation for me not seeing anything to respond to :-)
Thanks,
Ken
Kenneth Wolcott <kennethwolcott@gmail.com> writes:
> On Sunday, July 2, 2023 at 12:01:44 AM UTC-7, Luke A. Guest wrote:
>> On 30/06/2023 14:26, Luke A. Guest wrote:
>> > On 30/06/2023 12:30, Luke A. Guest wrote:
>> >> The /build/gnat gpr's have got a bit confused by the looks of things.
>> >>
>> >> Can you try this patch, it's made from a stash from a diff branch, if
>> >> it works I'll apply it and push it.
>> >
>> > Ignore that, I forgot something, try this one instead.
>> >
>>
>> Hello? Did this work for you?
>
> Hi Luke;
>
> I'm not sure what you want me to try.
>
> I don't see an attachment. I don't see a URL. I don't see a
> specific mention of a "patch"? on GitHub. Obviously I'm missing
> something. Sorry I appear quite daft :-(
>
> Thanks,
> Ken
Google Groups has suppressed Luke's two posts with attached patches.
On Sunday, July 2, 2023 at 12:01:44 AM UTC-7, Luke A. Guest wrote:
> On 30/06/2023 14:26, Luke A. Guest wrote:
> > On 30/06/2023 12:30, Luke A. Guest wrote:
> >> The /build/gnat gpr's have got a bit confused by the looks of things.
> >>
> >> Can you try this patch, it's made from a stash from a diff branch, if
> >> it works I'll apply it and push it.
> >
> > Ignore that, I forgot something, try this one instead.
> >
>
> Hello? Did this work for you?
Hi Luke;
I'm not sure what you want me to try.
I don't see an attachment. I don't see a URL. I don't see a specific mention of a "patch"? on GitHub. Obviously I'm missing something. Sorry I appear quite daft :-(
Thanks,
Ken
On 30/06/2023 14:26, Luke A. Guest wrote:
> On 30/06/2023 12:30, Luke A. Guest wrote:
>> The /build/gnat gpr's have got a bit confused by the looks of things.
>>
>> Can you try this patch, it's made from a stash from a diff branch, if
>> it works I'll apply it and push it.
>
> Ignore that, I forgot something, try this one instead.
>
Hello? Did this work for you?
On Saturday, July 1, 2023 at 6:08:21 PM UTC-7, Chris Townley wrote:
> On 01/07/2023 22:50, Kenneth Wolcott wrote:
> > On Saturday, July 1, 2023 at 2:39:06 PM UTC-7, Keith Thompson wrote:
> >> Kenneth Wolcott writes:
> >>> On Saturday, July 1, 2023 at 1:39:30 PM UTC-7, Jeffrey R.Carter wrote:
> >>>> On 2023-07-01 19:15, Kenneth Wolcott wrote:
> >> [...]
> >>>> For example, if a text file is one in which all the characters, except line
> >>>> terminators, are graphic characters, then it should be clear how to determine
> >>>> whether a file meets that definition of a text file.
> >>>
> >>> I think that is the definition that I'm going to pursue as the
> >>> simplest and effective definition.
> >> Think about how you want to handle tab characters (non-graphic but
> >> common in some text) and carriage return characters (non-graphic but
> >> part of a line terminator for Windows-style text files).
> >>
> >> Also think about the various ways of representing text: ASCII, Latin-1,
> >> UTF-8, UTF-16, etc.
> >
> > Thanks, Keith!
> >
> > It looks like just need to more carefully examine the existing Ada I/O packages and experiment with the possibilities...
> >
> > Ken
> Maybe worth looking at the unix file utility, docs and source are available
Thank you, Chris.
I have just downloaded the source code for the UNIX/Linus file command and am browsing around...
Thanks,
Ken
On 01/07/2023 22:50, Kenneth Wolcott wrote:
> On Saturday, July 1, 2023 at 2:39:06 PM UTC-7, Keith Thompson wrote:
>> Kenneth Wolcott writes:
>>> On Saturday, July 1, 2023 at 1:39:30 PM UTC-7, Jeffrey R.Carter wrote:
>>>> On 2023-07-01 19:15, Kenneth Wolcott wrote:
>> [...]
>>>> For example, if a text file is one in which all the characters, except line
>>>> terminators, are graphic characters, then it should be clear how to determine
>>>> whether a file meets that definition of a text file.
>>>
>>> I think that is the definition that I'm going to pursue as the
>>> simplest and effective definition.
>> Think about how you want to handle tab characters (non-graphic but
>> common in some text) and carriage return characters (non-graphic but
>> part of a line terminator for Windows-style text files).
>>
>> Also think about the various ways of representing text: ASCII, Latin-1,
>> UTF-8, UTF-16, etc.
>
> Thanks, Keith!
>
> It looks like just need to more carefully examine the existing Ada I/O packages and experiment with the possibilities...
>
> Ken
Maybe worth looking at the unix file utility, docs and source are available
--
Chris
On Saturday, July 1, 2023 at 2:39:06 PM UTC-7, Keith Thompson wrote:
> Kenneth Wolcott writes:
> > On Saturday, July 1, 2023 at 1:39:30 PM UTC-7, Jeffrey R.Carter wrote:
> >> On 2023-07-01 19:15, Kenneth Wolcott wrote:
> [...]
> >> For example, if a text file is one in which all the characters, except line
> >> terminators, are graphic characters, then it should be clear how to determine
> >> whether a file meets that definition of a text file.
> >
> > I think that is the definition that I'm going to pursue as the
> > simplest and effective definition.
> Think about how you want to handle tab characters (non-graphic but
> common in some text) and carriage return characters (non-graphic but
> part of a line terminator for Windows-style text files).
>
> Also think about the various ways of representing text: ASCII, Latin-1,
> UTF-8, UTF-16, etc.
Thanks, Keith!
It looks like just need to more carefully examine the existing Ada I/O packages and experiment with the possibilities...
Ken
Kenneth Wolcott <kennethwolcott@gmail.com> writes: > On Saturday, July 1, 2023 at 1:39:30 PM UTC-7, Jeffrey R.Carter wrote: >> On 2023-07-01 19:15, Kenneth Wolcott wrote: [...] >> For example, if a text file is one in which all the characters, except line >> terminators, are graphic characters, then it should be clear how to determine >> whether a file meets that definition of a text file. > > I think that is the definition that I'm going to pursue as the > simplest and effective definition. Think about how you want to handle tab characters (non-graphic but common in some text) and carriage return characters (non-graphic but part of a line terminator for Windows-style text files). Also think about the various ways of representing text: ASCII, Latin-1, UTF-8, UTF-16, etc. -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com Will write code for food. void Void(void) { Void(); } /* The recursive call of the void */
On Saturday, July 1, 2023 at 1:39:30 PM UTC-7, Jeffrey R.Carter wrote: > On 2023-07-01 19:15, Kenneth Wolcott wrote: > > > > Using "pure" (?) Ada, how to determine whether a file is a "text" file, not a binary? > That depends on the definition of a text file. Under Unix and Windows, all files > are sequences of bytes, and so may be considered sequences of Characters, and so > text files. > > If you can define what distinguishes text files from binary files, then it > should be fairly easy to write Ada to distinguish them. > > For example, if a text file is one in which all the characters, except line > terminators, are graphic characters, then it should be clear how to determine > whether a file meets that definition of a text file. I think that is the definition that I'm going to pursue as the simplest and effective definition. > > As a side question, how does one read "binary" files in Ada? > Ada has Direct_IO, Sequential_IO, and Stream_IO for reading binary files. Which > you would use and how to use it depends on what's in the file and what you need > to do with it. Ok, now that seems to be pretty obvious! I'll go and experiment further... Thank you! Ken
On 2023-07-01 19:15, Kenneth Wolcott wrote: > > Using "pure" (?) Ada, how to determine whether a file is a "text" file, not a binary? That depends on the definition of a text file. Under Unix and Windows, all files are sequences of bytes, and so may be considered sequences of Characters, and so text files. If you can define what distinguishes text files from binary files, then it should be fairly easy to write Ada to distinguish them. For example, if a text file is one in which all the characters, except line terminators, are graphic characters, then it should be clear how to determine whether a file meets that definition of a text file. > As a side question, how does one read "binary" files in Ada? Ada has Direct_IO, Sequential_IO, and Stream_IO for reading binary files. Which you would use and how to use it depends on what's in the file and what you need to do with it. -- Jeff Carter "Ada is the only language where users are happy to have compilation errors!" Jean-Pierre Rosen 166
Hi; Another very beginner question here... Using "pure" (?) Ada, how to determine whether a file is a "text" file, not a binary? Kind of like using the UNIX/Linux "file" command, but doesn't have to be comprehensive (yet). Something like the Perl "-T" feature. On the other hand, if there already exists an Ada implementation of the UNIX "file" command as a library, could you point me to that? As a side question, how does one read "binary" files in Ada? A UNIX/Linux use case for the previous sentence is the concatenation of two (or more) "binary" files that were created using the UNIX/Linux "split" command. So I'd be interested in emulating the UNIX "cat" command for "binary" files. These are just personal experiments for learning how to do all kinds of Ada I/O... Thanks, Ken Wolcott
Hello Vincent, Le 29/06/2023 à 10:49, Vincent D. a écrit : > Hello Pascal, > > Thank you for this contribution. Here are some comments: > - since UTFString is a class ("a tagged record type"), why don't you create an abstract root "UXString" and then derive specialized object types ? Like UTF_8_XString, UTF_16_XString, ASCII_XString, Win_1252_XString, Latin_XString, etc. Well, that's a possibility chosen in some other Ada Strings libraries. I've preferred that the API of legacy Ada "string" types to be closed to those of Ada library so that the adaptation would be easy. These are not intended to be used outside legacy code adaptation. Note that I've renamed them as character arrays rather than strings in order to accentuate the semantic difference. > - The default format to convert between different encodings should be UTF-8 as it is now ubiquitous. Conversions are between UXString and encodings, not between encodings. >> [...] moreover in the case of strings accentuated in French and strings containing emojis the process times are also improved (factor 7 to 8 by compared to UXStrings1 > - I find quite astonishing to have a factor 8 compared to UTF-8 encoding. Do you have an explanation ? This looks like a poor implementation because UTF-8 encoding is fast and allows direct manipulation in most cases. Maybe because random access is treated as sequential access for UTF-8 encoded strings but this again is poor implementation. You got it: "most cases". Apart from complex implementations, if you want to access a specific position you have to parse from the beginning of the UTF-8 data as UXStrings1 does. UXStrings2 always computes if the resulting data are all ASCII, so the access is then direct. UXStrings3 is internally like an Unicode array, so the access is direct. Best regards, Pascal.
Frank Jørgen Jørgensen <fjj@itema.no> writes: > I'm running the below program with GNAT Community 2020 (20200818-93) > on Windows 11 Home. > I have some problems trying to save big numbers to a file - so I > noticed this behaviour: > If I open Test.dat in Visual Studio Hex editor, it seems like this > program saves this big number with a different bit pattern each time. > Is that as expected? > I do have some problems reading back the big numbers in my real code. Looking at the source for Big_Integer[1] I see no trace of streaming support; what you got streamed was the address of some allocated data used under the hood to contain the big integer. I don't know whether the ARM requires/expects Big_Integer to be streamable, but I think you had every reason to expect it! [1] https://github.com/gcc-mirror/gcc/blob/7e904d6c7f252ee947c237ed32dd43b2c248384d/gcc/ada/libgnat/a-nbnbin.ads#L171
Le 27/06/2023 à 22:53, Rod Kay a écrit : > Hello again all, > > In the hope it might help other people building or OS packaging > GnatStudio, I've prepared a 'cookbook' of sorts. > > It provides build instructions for the entire GnatStudio project > stack, beginning with gprbuild-bootstrap and culminating in the build of > gnatstudio. The individual 'recipes' take the form of pacman PKGBUILDs > with tarballs and patches. > > Here is the link ... > > https://github.com/charlie5/archlinux-gnatstudio-support/tree/main/gnatstudio-cookbook Hello Rod, Thanks for sharing, I'll take a look. I'm building GnatStudio for macOS Ventura. Currently at step Ada Language Server, next to the step GnatStudio itself ;-) I'll be sure to share my progress. In the meantime here is my approach for version 23.0w (in French language): http://blady.pagesperso-orange.fr/telechargements/gnat/Install-GS-Quartz_WF.pdf Pascal.
On 2023-06-30 21:28, Frank Jørgen Jørgensen wrote: > I'm running the below program with GNAT Community 2020 (20200818-93) > on Windows 11 Home. > I have some problems trying to save big numbers to a file - so I noticed this behaviour: > If I open Test.dat in Visual Studio Hex editor, it seems like this program saves this big number with a different bit pattern each time. > Is that as expected? > I do have some problems reading back the big numbers in my real code. > When I compile I get the warning: "Ada.Numerics.Big_Numbers.Big_Integers" is an Ada 202x unit. > > -- > with Ada.Streams.Stream_IO; use Ada.Streams.Stream_IO; > with Ada.Numerics.Big_Numbers.Big_Integers; > > procedure Test is > > B1 : Ada.Numerics.Big_Numbers.Big_Integers.Big_Integer; > F1 : File_Type; > S1 : Stream_Access; > begin > B1 := 1; > > Ada.Streams.Stream_IO.Create (F1, Out_File, "Test.dat"); > S1 := Ada.Streams.Stream_IO.Stream (F1); > Ada.Numerics.Big_Numbers.Big_Integers.Big_Integer'Write(S1, B1); > Ada.Numerics.Big_Numbers.Big_Integers.Big_Integer'Output(S1, B1); > Ada.Streams.Stream_IO.Close (F1); > end Test; As a general rule, you should never use predefined implementations of stream attributes except for Stream_Element or Character. Anything else you must always override or else not use. If you want to serialize signed integers use some portable format for it. E.g. a chained encoding. Here is a test program for a straightforward implementation of chained store/restore: ------------------------- with Ada.Streams.Stream_IO; use Ada.Streams.Stream_IO; with Ada.Numerics.Big_Numbers.Big_Integers; with Ada.Exceptions; with Ada.IO_Exceptions; procedure Test is use Ada.Streams; use Ada.Numerics.Big_Numbers.Big_Integers; use Ada.Exceptions; use Ada.Streams.Stream_IO; Two : constant Big_Integer := To_Big_Integer (2); package Conversions is new Unsigned_Conversions (Stream_Element); use Conversions; function Get ( Stream : in out Root_Stream_Type'Class ) return Big_Integer is Result : Big_Integer; Power : Natural := 6; Negative : Boolean; Buffer : Stream_Element_Array (1..1); Last : Stream_Element_Offset; This : Stream_Element renames Buffer (1); begin Stream.Read (Buffer, Last); if Last /= 1 then raise End_Error; end if; Result := To_Big_Integer ((This and 2#0111_1110#) / 2); Negative := 0 /= (This and 1); if 0 = (This and 16#80#) then if Negative then return -Result - 1; else return Result; end if; end if; loop Stream.Read (Buffer, Last); if Last /= 1 then raise End_Error; end if; Result := Result + Two**Power * To_Big_Integer (This and 16#7F#); if 0 = (This and 16#80#) then if Negative then return -Result - 1; else return Result; end if; end if; Power := Power + 7; end loop; end Get; procedure Put ( Stream : in out Root_Stream_Type'Class; Value : Big_Integer ) is Item : Big_Integer := Value; Buffer : Stream_Element_Array (1..1); This : Stream_Element renames Buffer (1); begin if Item >= 0 then Item := Value; This := From_Big_Integer (Item mod (16#40#)) * 2; else Item := -(Value + 1); This := From_Big_Integer (Item mod (16#40#)) * 2 + 1; end if; Item := Item / 16#40#; if Item = 0 then Stream.Write (Buffer); return; end if; This := This or 16#80#; Stream.Write (Buffer); loop This := From_Big_Integer (Item mod 16#80#) or 16#80#; Item := Item / 16#80#; if Item = 0 then This := This and 16#7F#; Stream.Write (Buffer); return; end if; Stream.Write (Buffer); end loop; end Put; F : File_Type; begin Create (F, Out_File, "Test.dat"); for I in -1_000_000..1_000_000 loop Put (Stream (F).all, To_Big_Integer (I)); end loop; Close (F); Open (F, In_File, "Test.dat"); for I in -1_000_000..1_000_000 loop declare Value : constant Big_Integer := Get (Stream (F).all); begin if Value /= To_Big_Integer (I) then raise Data_Error; end if; end; end loop; Close (F); end Test; ------------------------- The above could be optimized to work with buffers rather than reading/writing stream octets one by one. It is a long story, but normally you would implement some data blocks with the length count on top of the stream in order to avoid inefficient octet by octet reading and add an error correction layer. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
Hi I'm running the below program with GNAT Community 2020 (20200818-93) on Windows 11 Home. I have some problems trying to save big numbers to a file - so I noticed this behaviour: If I open Test.dat in Visual Studio Hex editor, it seems like this program saves this big number with a different bit pattern each time. Is that as expected? I do have some problems reading back the big numbers in my real code. When I compile I get the warning: "Ada.Numerics.Big_Numbers.Big_Integers" is an Ada 202x unit. Frank -- with Ada.Streams.Stream_IO; use Ada.Streams.Stream_IO; with Ada.Numerics.Big_Numbers.Big_Integers; procedure Test is B1 : Ada.Numerics.Big_Numbers.Big_Integers.Big_Integer; F1 : File_Type; S1 : Stream_Access; begin B1 := 1; Ada.Streams.Stream_IO.Create (F1, Out_File, "Test.dat"); S1 := Ada.Streams.Stream_IO.Stream (F1); Ada.Numerics.Big_Numbers.Big_Integers.Big_Integer'Write(S1, B1); Ada.Numerics.Big_Numbers.Big_Integers.Big_Integer'Output(S1, B1); Ada.Streams.Stream_IO.Close (F1); end Test;
On 30/06/2023 16:41, Kenneth Wolcott wrote:
> On Friday, June 30, 2023 at 1:04:34 AM UTC-7, Luke A. Guest wrote:
>> On 29/06/2023 23:04, Kenneth Wolcott wrote:
>>
>>>> $ sdl2-config --cflags
>>>> $ sdl2-config --libs
>>>
>>> sdl2-config --cflags
>>> -I/opt/local/include/SDL2 -D_THREAD_SAFE
>> That's odd. Can you show me the output of this?
>>
>> $ ls /opt/local/include/SDL2
>
> ls /opt/local/include/SDL2
>
> SDL.h SDL_joystick.h SDL_opengles2_khrplatform.h SDL_test_crc32.h
...
As I thought, means, these things can be normalised a bit in my source.
On Friday, June 30, 2023 at 1:04:34 AM UTC-7, Luke A. Guest wrote: > On 29/06/2023 23:04, Kenneth Wolcott wrote: > > >> $ sdl2-config --cflags > >> $ sdl2-config --libs > > > > sdl2-config --cflags > > -I/opt/local/include/SDL2 -D_THREAD_SAFE > That's odd. Can you show me the output of this? > > $ ls /opt/local/include/SDL2 ls /opt/local/include/SDL2 SDL.h SDL_joystick.h SDL_opengles2_khrplatform.h SDL_test_crc32.h SDL_assert.h SDL_keyboard.h SDL_pixels.h SDL_test_font.h SDL_atomic.h SDL_keycode.h SDL_platform.h SDL_test_fuzzer.h SDL_audio.h SDL_loadso.h SDL_power.h SDL_test_harness.h SDL_bits.h SDL_locale.h SDL_quit.h SDL_test_images.h SDL_blendmode.h SDL_log.h SDL_rect.h SDL_test_log.h SDL_clipboard.h SDL_main.h SDL_render.h SDL_test_md5.h SDL_config.h SDL_messagebox.h SDL_revision.h SDL_test_memory.h SDL_cpuinfo.h SDL_metal.h SDL_rwops.h SDL_test_random.h SDL_egl.h SDL_misc.h SDL_scancode.h SDL_thread.h SDL_endian.h SDL_mouse.h SDL_sensor.h SDL_timer.h SDL_error.h SDL_mutex.h SDL_shape.h SDL_touch.h SDL_events.h SDL_name.h SDL_stdinc.h SDL_types.h SDL_filesystem.h SDL_opengl.h SDL_surface.h SDL_version.h SDL_gamecontroller.h SDL_opengl_glext.h SDL_system.h SDL_video.h SDL_gesture.h SDL_opengles.h SDL_syswm.h SDL_vulkan.h SDL_guid.h SDL_opengles2.h SDL_test.h begin_code.h SDL_haptic.h SDL_opengles2_gl2.h SDL_test_assert.h close_code.h SDL_hidapi.h SDL_opengles2_gl2ext.h SDL_test_common.h SDL_hints.h SDL_opengles2_gl2platform.h SDL_test_compare.h > > sdl2-config --libs > > -L/opt/local/lib -lSDL2
[-- Attachment #1: Type: text/plain, Size: 293 bytes --] On 30/06/2023 12:30, Luke A. Guest wrote: > The /build/gnat gpr's have got a bit confused by the looks of things. > > Can you try this patch, it's made from a stash from a diff branch, if it > works I'll apply it and push it. Ignore that, I forgot something, try this one instead. [-- Attachment #2: test.patch --] [-- Type: text/x-patch, Size: 6475 bytes --] diff --git a/build/gnat/makefile b/build/gnat/makefile index b13930f..0046490 100644 --- a/build/gnat/makefile +++ b/build/gnat/makefile @@ -90,7 +90,7 @@ tests: $(LIB_NAME) tests.gpr $(TESTS_SRCS) tests.gpr: $(TESTS_SRCS) gen/$(SDL_MODE)/test/libtestmaths.so $(GPRMAKE) -p -gnat2012 -XSDL_MODE=$(SDL_MODE) -XSDL_PLATFORM=$(SDL_PLATFORM) \ - -Ptests.gpr ${SDL2_CONFIG} + -Ptests.gpr # ${SDL2_CONFIG} # Maths library @@ -111,7 +111,7 @@ unit_tests: $(LIB_NAME) build_unit_tests/unit_tests build_unit_tests/unit_tests: $(GPRMAKE) -p -gnat2012 -XSDL_MODE=$(SDL_MODE) -XSDL_PLATFORM=$(SDL_PLATFORM) \ - -Punit_tests.gpr ${SDL2_CONFIG} + -Punit_tests.gpr # ${SDL2_CONFIG} .PHONY: clean-unit_tests diff --git a/build/gnat/sdlada.gpr b/build/gnat/sdlada.gpr index adc77f5..13ef8ee 100644 --- a/build/gnat/sdlada.gpr +++ b/build/gnat/sdlada.gpr @@ -1,10 +1,21 @@ library project SDLAda is - type Platform_Type is ("linux", "bsd", "windows", "macosx", "macos_homebrew", "ios", "android"); + type Platform_Type is ("linux", + "bsd", + "windows", + "macosx", + "macos_homebrew", + "macos_ports", + "ios", + "android"); type Mode_Type is ("debug", "release"); Platform : Platform_Type := external ("SDL_PLATFORM", "linux"); Mode : Mode_Type := external ("SDL_MODE", "debug"); + package Builder is + for Default_Switches ("Ada") use ("-gnat2012", "-gnata"); + end Builder; + Source_Platform := ""; case Platform is @@ -52,6 +63,11 @@ library project SDLAda is "-I/usr/local/include", "-D_REENTRANT"); + when "macos_ports" => + C_Switches := C_Switches & ("-DSDL_MACPORTS", + "-I/opt/local/include", + "-D_THREAD_SAFE"); + when others => null; end case; @@ -59,4 +75,33 @@ library project SDLAda is for Default_Switches ("C") use Common_Switches & C_Switches; for Default_Switches ("Ada") use Common_Switches & Ada_Switches; end Compiler; + + package Linker is + Linker_Switches := (); + + case Platform is + when "linux" | "bsd" | "android" | "windows" => + Linker_Switches := Linker_Switches & ("-lSDL2", + "-lSDL2_ttf", + "-lSDL2_image", + "-L/usr/lib64"); + + when "macos_homebrew" => + Linker_Switches := Linker_Switches & ("-lSDL2", + "-lSDL2_ttf", + "-lSDL2_image", + "-L/usr/local/lib"); + + when "macos_ports" => + Linker_Switches := Linker_Switches & ("-lSDL2", + "-lSDL2_ttf", + "-lSDL2_image", + "-L/opt/local/lib"); + + when others => + null; + end case; + + for Switches ("Ada") use Linker_Switches; + end Linker; end SDLAda; diff --git a/build/gnat/sdlada_image.gpr b/build/gnat/sdlada_image.gpr index 1098095..5a9764f 100644 --- a/build/gnat/sdlada_image.gpr +++ b/build/gnat/sdlada_image.gpr @@ -11,4 +11,5 @@ library project SDLAda_Image is for Library_Version use "libsdlada_image.so." & Version; package Compiler renames SDLAda.Compiler; + package Linker renames SDLAda.Linker; end SDLAda_Image; diff --git a/build/gnat/tests.gpr b/build/gnat/tests.gpr index 70dceff..51ee201 100644 --- a/build/gnat/tests.gpr +++ b/build/gnat/tests.gpr @@ -15,24 +15,5 @@ project Tests is "ttf.adb"); package Compiler renames SDLAda.Compiler; - - package Linker is - - Linker_Switches := (); - - case Sdlada.Platform is - when "macos_homebrew" => - Linker_Switches := Linker_Switches & ("-lSDL2", - "-lSDL2_ttf", - "-lSDL2_image", - "-L/usr/local/lib"); - - when others => - null; - end case; - - for Switches ("Ada") use Linker_Switches; - - end Linker; - + package Linker renames SDLAda.Linker; end Tests; diff --git a/build/gnat/tests_image.gpr b/build/gnat/tests_image.gpr index f23be3c..fd68309 100644 --- a/build/gnat/tests_image.gpr +++ b/build/gnat/tests_image.gpr @@ -8,6 +8,7 @@ project Tests_Image is for Main use ("load_surface.adb"); package Compiler renames SDLAda.Compiler; + package Linker renames SDLAda.Linker; -- package Builder is -- for Default_Switches ("Ada") use ("-gnat2012", "-gnata"); --, "-gnatG"); diff --git a/build/gnat/unit_tests.gpr b/build/gnat/unit_tests.gpr index c469a34..27dd38f 100644 --- a/build/gnat/unit_tests.gpr +++ b/build/gnat/unit_tests.gpr @@ -17,4 +17,5 @@ project Unit_Tests is -- end Ide; package Compiler renames SDLAda.Compiler; + package Linker renames SDLAda.Linker; end Unit_Tests; diff --git a/src/image/version_images.c b/src/image/version_images.c index ba5be68..47813a1 100644 --- a/src/image/version_images.c +++ b/src/image/version_images.c @@ -21,7 +21,7 @@ * distribution. **********************************************************************************************************************/ #ifdef __APPLE__ - #ifdef SDL_HOMEBREW + #if defined (SDL_HOMEBREW) || defined (SDL_MACPORTS) #include <SDL2/SDL_image.h> #else #include <SDL2_image/SDL_image.h> diff --git a/src/ttf/version_ttf.c b/src/ttf/version_ttf.c index cedfebc..0819103 100644 --- a/src/ttf/version_ttf.c +++ b/src/ttf/version_ttf.c @@ -21,7 +21,7 @@ * distribution. **********************************************************************************************************************/ #ifdef __APPLE__ - #ifdef SDL_HOMEBREW + #if defined (SDL_HOMEBREW) || defined (SDL_MACPORTS) #include <SDL2/SDL_ttf.h> #else #include <SDL2_ttf/SDL_ttf.h>
[-- Attachment #1: Type: text/plain, Size: 191 bytes --] The /build/gnat gpr's have got a bit confused by the looks of things. Can you try this patch, it's made from a stash from a diff branch, if it works I'll apply it and push it. Luke. [-- Attachment #2: test.patch --] [-- Type: text/x-patch, Size: 5465 bytes --] diff --git a/build/gnat/makefile b/build/gnat/makefile index b13930f..0046490 100644 --- a/build/gnat/makefile +++ b/build/gnat/makefile @@ -90,7 +90,7 @@ tests: $(LIB_NAME) tests.gpr $(TESTS_SRCS) tests.gpr: $(TESTS_SRCS) gen/$(SDL_MODE)/test/libtestmaths.so $(GPRMAKE) -p -gnat2012 -XSDL_MODE=$(SDL_MODE) -XSDL_PLATFORM=$(SDL_PLATFORM) \ - -Ptests.gpr ${SDL2_CONFIG} + -Ptests.gpr # ${SDL2_CONFIG} # Maths library @@ -111,7 +111,7 @@ unit_tests: $(LIB_NAME) build_unit_tests/unit_tests build_unit_tests/unit_tests: $(GPRMAKE) -p -gnat2012 -XSDL_MODE=$(SDL_MODE) -XSDL_PLATFORM=$(SDL_PLATFORM) \ - -Punit_tests.gpr ${SDL2_CONFIG} + -Punit_tests.gpr # ${SDL2_CONFIG} .PHONY: clean-unit_tests diff --git a/build/gnat/sdlada.gpr b/build/gnat/sdlada.gpr index adc77f5..13ef8ee 100644 --- a/build/gnat/sdlada.gpr +++ b/build/gnat/sdlada.gpr @@ -1,10 +1,21 @@ library project SDLAda is - type Platform_Type is ("linux", "bsd", "windows", "macosx", "macos_homebrew", "ios", "android"); + type Platform_Type is ("linux", + "bsd", + "windows", + "macosx", + "macos_homebrew", + "macos_ports", + "ios", + "android"); type Mode_Type is ("debug", "release"); Platform : Platform_Type := external ("SDL_PLATFORM", "linux"); Mode : Mode_Type := external ("SDL_MODE", "debug"); + package Builder is + for Default_Switches ("Ada") use ("-gnat2012", "-gnata"); + end Builder; + Source_Platform := ""; case Platform is @@ -52,6 +63,11 @@ library project SDLAda is "-I/usr/local/include", "-D_REENTRANT"); + when "macos_ports" => + C_Switches := C_Switches & ("-DSDL_MACPORTS", + "-I/opt/local/include", + "-D_THREAD_SAFE"); + when others => null; end case; @@ -59,4 +75,33 @@ library project SDLAda is for Default_Switches ("C") use Common_Switches & C_Switches; for Default_Switches ("Ada") use Common_Switches & Ada_Switches; end Compiler; + + package Linker is + Linker_Switches := (); + + case Platform is + when "linux" | "bsd" | "android" | "windows" => + Linker_Switches := Linker_Switches & ("-lSDL2", + "-lSDL2_ttf", + "-lSDL2_image", + "-L/usr/lib64"); + + when "macos_homebrew" => + Linker_Switches := Linker_Switches & ("-lSDL2", + "-lSDL2_ttf", + "-lSDL2_image", + "-L/usr/local/lib"); + + when "macos_ports" => + Linker_Switches := Linker_Switches & ("-lSDL2", + "-lSDL2_ttf", + "-lSDL2_image", + "-L/opt/local/lib"); + + when others => + null; + end case; + + for Switches ("Ada") use Linker_Switches; + end Linker; end SDLAda; diff --git a/build/gnat/sdlada_image.gpr b/build/gnat/sdlada_image.gpr index 1098095..5a9764f 100644 --- a/build/gnat/sdlada_image.gpr +++ b/build/gnat/sdlada_image.gpr @@ -11,4 +11,5 @@ library project SDLAda_Image is for Library_Version use "libsdlada_image.so." & Version; package Compiler renames SDLAda.Compiler; + package Linker renames SDLAda.Linker; end SDLAda_Image; diff --git a/build/gnat/tests.gpr b/build/gnat/tests.gpr index 70dceff..51ee201 100644 --- a/build/gnat/tests.gpr +++ b/build/gnat/tests.gpr @@ -15,24 +15,5 @@ project Tests is "ttf.adb"); package Compiler renames SDLAda.Compiler; - - package Linker is - - Linker_Switches := (); - - case Sdlada.Platform is - when "macos_homebrew" => - Linker_Switches := Linker_Switches & ("-lSDL2", - "-lSDL2_ttf", - "-lSDL2_image", - "-L/usr/local/lib"); - - when others => - null; - end case; - - for Switches ("Ada") use Linker_Switches; - - end Linker; - + package Linker renames SDLAda.Linker; end Tests; diff --git a/build/gnat/tests_image.gpr b/build/gnat/tests_image.gpr index f23be3c..fd68309 100644 --- a/build/gnat/tests_image.gpr +++ b/build/gnat/tests_image.gpr @@ -8,6 +8,7 @@ project Tests_Image is for Main use ("load_surface.adb"); package Compiler renames SDLAda.Compiler; + package Linker renames SDLAda.Linker; -- package Builder is -- for Default_Switches ("Ada") use ("-gnat2012", "-gnata"); --, "-gnatG"); diff --git a/build/gnat/unit_tests.gpr b/build/gnat/unit_tests.gpr index c469a34..27dd38f 100644 --- a/build/gnat/unit_tests.gpr +++ b/build/gnat/unit_tests.gpr @@ -17,4 +17,5 @@ project Unit_Tests is -- end Ide; package Compiler renames SDLAda.Compiler; + package Linker renames SDLAda.Linker; end Unit_Tests;
On 29/06/2023 23:04, Kenneth Wolcott wrote: >> $ sdl2-config --cflags >> $ sdl2-config --libs > > sdl2-config --cflags > -I/opt/local/include/SDL2 -D_THREAD_SAFE That's odd. Can you show me the output of this? $ ls /opt/local/include/SDL2 > > sdl2-config --libs > -L/opt/local/lib -lSDL2
On Thursday, June 29, 2023 at 2:22:30 PM UTC-7, Simon Wright wrote: > Kenneth Wolcott writes: > > > 2. I stopped using Alire because I wanted a native gnat compiler and > > Alire didn't provide one and now that I installed and am using Simon's > > (again, thank you) build, Alire refuses to "get" some interesting > > packages. I'll respond later with some specific examples. Perhaps I > > have Alire improperly installed or configured... > I wrote up something about this[1]. > > Alire will download and install external packages (e.g. SDL2) if it > knows how to use the host system's package manager. The "nightly" > builds[2] for macOS know how to install via Homebrew, provided that the > external manifest has been updated[3]. > > If someone wants to upgrade Alire to use MacPorts, I'm sure that would > be welcomed. > > Adding aarch64 compilers to the mix makes things somewhat more > complicated. > > Does MacPorts provide aarch64 (aka arm64) binary libraries? the object > code and libraries that are linked to produce an executable must be > consistent, all x86_64 or all aarch64. I have no configured MacPorts to not accept any binaries that aren't aarch64 and I do almost all of my upgrade+updates using the source flag so that I build from source. There's only one issue that I've experienced after making that change: port outdated sbcl-bootstrap 2.1.2_0 < 2.2.9_0 The following are two lines from the failed upgrade to MacPorts, but they don't really adversely affect me because I have a prior version (I don't recall what I have that requires this package :-) ) Error: Cannot install qt4-mac for the arch 'x86_64' because Error: its dependency dbus does not build for the required arch by default port installed | grep sbcl-bootstrap sbcl-bootstrap @2.1.2_0 (active) > [1] > https://forward-in-code.blogspot.com/2023/06/alire-on-macos-revisited.html > [2] https://github.com/alire-project/alire/releases > [3] https://github.com/alire-project/alire-index/pull/832 I'll take a look at those references... Thanks, Ken
On Thursday, June 29, 2023 at 12:35:08 PM UTC-7, Luke A. Guest wrote: > On 29/06/2023 18:34, Kenneth Wolcott wrote: > > > 1. I'm using gnatmake versus gprbuild because I just haven't gotten used to it yet, not avoiding it specifically. Of course it looks like it makes things easier... > gnatmake cannot handle project files anymore, it is for building single > applications, e.g. gnatmake my_app.adb, nothing more. You need to use > gprbuild with sdlada. > > 3. I have installed libsdl2 via MacPorts: > > port list | grep sdl2 > > libsdl2_mixer @2.6.3 audio/libsdl2_mixer > > libsdl2 @2.28.0 devel/libsdl2 > > libsdl2-snowleopard @2.0.22 devel/libsdl2-snowleopard > > libsdl2_gfx @1.0.4 devel/libsdl2_gfx > > libsdl2_image @2.6.3 devel/libsdl2_image > > libsdl2_net @2.2.0 devel/libsdl2_net > > libsdl2_ttf @2.20.2 devel/libsdl2_ttf > Right, so the other SDL libs usually install to the same place SDL is, > so what are the locations? Run these commands and tell me the results: Actually, me the dummy, provided for you all what MacPorts has, not what I have :-) This is what I have installed via MacPorts: port installed | grep sdl libsdl2 @2.24.2_0 libsdl2 @2.26.1_0 libsdl2 @2.26.2_0 libsdl2 @2.26.3_0 libsdl2 @2.26.4_0 libsdl2 @2.26.5_0 libsdl2 @2.28.0_0 (active) > $ sdl2-config --cflags > $ sdl2-config --libs sdl2-config --cflags -I/opt/local/include/SDL2 -D_THREAD_SAFE sdl2-config --libs -L/opt/local/lib -lSDL2 > > 4. Examples of Alire's "get" failure: > Forget about alire for now, I can update the main repo and you can grab > the source from there and use GPR_PROJECT_PATH=<path to > sdlada>/build/gnat:$GPR_PROJECT_PATH to build. Ok, cool. > > alr --no-color get libsdl2_ttf > > ERROR: No source release indexed for the requested crate, and cannot use system packages in unknown distribution > > > > alr --no-color get libsdl2 > > ERROR: No source release indexed for the requested crate, and cannot use system packages in unknown distribution > They're probably missing from the mac m1 specific index. Well, that would probably explain the problem :-) Thanks, Ken
Kenneth Wolcott <kennethwolcott@gmail.com> writes: > 2. I stopped using Alire because I wanted a native gnat compiler and > Alire didn't provide one and now that I installed and am using Simon's > (again, thank you) build, Alire refuses to "get" some interesting > packages. I'll respond later with some specific examples. Perhaps I > have Alire improperly installed or configured... I wrote up something about this[1]. Alire will download and install external packages (e.g. SDL2) if it knows how to use the host system's package manager. The "nightly" builds[2] for macOS know how to install via Homebrew, provided that the external manifest has been updated[3]. If someone wants to upgrade Alire to use MacPorts, I'm sure that would be welcomed. Adding aarch64 compilers to the mix makes things somewhat more complicated. Does MacPorts provide aarch64 (aka arm64) binary libraries? the object code and libraries that are linked to produce an executable must be consistent, all x86_64 or all aarch64. [1] https://forward-in-code.blogspot.com/2023/06/alire-on-macos-revisited.html [2] https://github.com/alire-project/alire/releases [3] https://github.com/alire-project/alire-index/pull/832
On 29/06/2023 18:34, Kenneth Wolcott wrote: > 1. I'm using gnatmake versus gprbuild because I just haven't gotten used to it yet, not avoiding it specifically. Of course it looks like it makes things easier... gnatmake cannot handle project files anymore, it is for building single applications, e.g. gnatmake my_app.adb, nothing more. You need to use gprbuild with sdlada. > 3. I have installed libsdl2 via MacPorts: > port list | grep sdl2 > libsdl2_mixer @2.6.3 audio/libsdl2_mixer > libsdl2 @2.28.0 devel/libsdl2 > libsdl2-snowleopard @2.0.22 devel/libsdl2-snowleopard > libsdl2_gfx @1.0.4 devel/libsdl2_gfx > libsdl2_image @2.6.3 devel/libsdl2_image > libsdl2_net @2.2.0 devel/libsdl2_net > libsdl2_ttf @2.20.2 devel/libsdl2_ttf Right, so the other SDL libs usually install to the same place SDL is, so what are the locations? Run these commands and tell me the results: $ sdl2-config --cflags $ sdl2-config --libs > 4. Examples of Alire's "get" failure: Forget about alire for now, I can update the main repo and you can grab the source from there and use GPR_PROJECT_PATH=<path to sdlada>/build/gnat:$GPR_PROJECT_PATH to build. > alr --no-color get libsdl2_ttf > ERROR: No source release indexed for the requested crate, and cannot use system packages in unknown distribution > > alr --no-color get libsdl2 > ERROR: No source release indexed for the requested crate, and cannot use system packages in unknown distribution They're probably missing from the mac m1 specific index.
On 29/06/2023 17:06, Simon Wright wrote:
> "Luke A. Guest" <laguest@archeia.com> writes:
>
>> Yeah, unfortunately I cannot remove the C files as they turn C macros
>> into variables and are useful at runtime, see the sdlada repo for
>> someone who wants to get rid of them.
>
> I had exactly this in tcladashell; even better, a Tcl script to generate
> a C source, compiled against the Tcl/Tk libraries and run to generate
> Ada source specifying record sizes/alignments.
I bet you never had someone try to remove the C file though.
On Thursday, June 29, 2023 at 9:06:56 AM UTC-7, Simon Wright wrote:
> "Luke A. Guest" writes:
>
> > Yeah, unfortunately I cannot remove the C files as they turn C macros
> > into variables and are useful at runtime, see the sdlada repo for
> > someone who wants to get rid of them.
> I had exactly this in tcladashell; even better, a Tcl script to generate
> a C source, compiled against the Tcl/Tk libraries and run to generate
> Ada source specifying record sizes/alignments.
Hi Luke & Simon;
Let's see if I can properly address all of the wonderful responses in a summarized fashion.
1. I'm using gnatmake versus gprbuild because I just haven't gotten used to it yet, not avoiding it specifically. Of course it looks like it makes things easier...
2. I stopped using Alire because I wanted a native gnat compiler and Alire didn't provide one and now that I installed and am using Simon's (again, thank you) build, Alire refuses to "get" some interesting packages. I'll respond later with some specific examples. Perhaps I have Alire improperly installed or configured...
3. I have installed libsdl2 via MacPorts:
port list | grep sdl2
libsdl2_mixer @2.6.3 audio/libsdl2_mixer
libsdl2 @2.28.0 devel/libsdl2
libsdl2-snowleopard @2.0.22 devel/libsdl2-snowleopard
libsdl2_gfx @1.0.4 devel/libsdl2_gfx
libsdl2_image @2.6.3 devel/libsdl2_image
libsdl2_net @2.2.0 devel/libsdl2_net
libsdl2_ttf @2.20.2 devel/libsdl2_ttf
4. Examples of Alire's "get" failure:
alr --no-color search --crates sdl
labs_solar_system A set of SDL-based exercises to learn Ada
libsdl2 Simple DirectMedia Layer development files
libsdl2_image Simple DirectMedia Layer development files - Image
libsdl2_ttf Simple DirectMedia Layer development files - TTF
pygamer_simulator SDL simulator of the AdaFruit PyGamer console
sdlada Ada 2012 SDL 2.x bindings.
alr --no-color get sdlada
Warning:
Warning: New solution is incomplete.
Warning: +~ libsdl2 ^2.0.0 (new,external)
Warning: +~ libsdl2_image ^2.0.0 (new,external)
Warning: +~ libsdl2_ttf ^2.0.0 (new,external)
Warning: + make 3.81.0 (new)
Warning:
Warning: Could not find a complete solution for sdlada=2.5.5
Build will fail unless externals are made available, do you want to continue?
[Y] Yes [N] No (default is No) n
ERROR: Crate retrieval abandoned.
alr --no-color get libsdl2_ttf
ERROR: No source release indexed for the requested crate, and cannot use system packages in unknown distribution
alr --no-color get libsdl2
ERROR: No source release indexed for the requested crate, and cannot use system packages in unknown distribution
Thanks,
Ken
"Luke A. Guest" <laguest@archeia.com> writes:
> Yeah, unfortunately I cannot remove the C files as they turn C macros
> into variables and are useful at runtime, see the sdlada repo for
> someone who wants to get rid of them.
I had exactly this in tcladashell; even better, a Tcl script to generate
a C source, compiled against the Tcl/Tk libraries and run to generate
Ada source specifying record sizes/alignments.
On 29/06/2023 14:12, Simon Wright wrote:
> Kenneth Wolcott <kennethwolcott@gmail.com> writes:
>
>> Since I'm [...] using gnatmake
>
> I don't understand why you'd want to use gnatmake? Most people who
> provide packaged libraries (e.g. sdlada) include a GPR file which saves
> you a raft of pain if you use it. OK, you have to learn something about
> gprbuild, but then you have to learn how to drive gnatmake (e.g. the
> previous discussion about -I). Also, sdlada includes 3 C source files,
> and so far as I know gnatmake doesn't know how to build C files, whereas
> gprbuild does and build/gnat/sdlada.gpr drives the needed compilations.
Yeah, unfortunately I cannot remove the C files as they turn C macros
into variables and are useful at runtime, see the sdlada repo for
someone who wants to get rid of them.
Kenneth Wolcott <kennethwolcott@gmail.com> writes: > Since I'm [...] using gnatmake I don't understand why you'd want to use gnatmake? Most people who provide packaged libraries (e.g. sdlada) include a GPR file which saves you a raft of pain if you use it. OK, you have to learn something about gprbuild, but then you have to learn how to drive gnatmake (e.g. the previous discussion about -I). Also, sdlada includes 3 C source files, and so far as I know gnatmake doesn't know how to build C files, whereas gprbuild does and build/gnat/sdlada.gpr drives the needed compilations. > I'm on a Mac mini > with an M1 chip, ALR refuses to get most packages because I don't have > a native Ada compiler Can you give us an example of a package that alr refuses to get?
Kenneth Wolcott <kennethwolcott@gmail.com> writes:
> I heavily use MacPorts. I keep hearing that it is a very bad idea to
> have MacPorts and HomeBrew concurrently installed on the same machine.
> Is it at all possible to do this without HomeBrew? Apparently I did
> not read your documentation carefully enough...I thought that having
> SDL installed via HomeBrew was optional, not required.
It's quite tricky to get the C includes and library directories working;
using Homebrew doesn't make it any easier, and the fact that the Mac
compilers (both the ones I've provided and the ones you get via Alire)
don't look in /usr/local by default doesn't help.
Having the external SDL2/SDL2_images/SDL22_ttf installed via Homebrew
isn't mandatory, but they do have to be installed! I expect that
MacPorts can do this.
With HomeBrew, installed packages are(almost always) under
$HOMEBREW_PREFIX, and I've defined these environment variables globally:
export C_INCLUDE_PATH=$HOMEBREW_PREFIX/include
export LIBRARY_PATH=$HOMEBREW_PREFIX/lib
I'd be surprised if MacPorts doesn't do similar
(e.g. MACPORTS_PREFIX=/opt/local ??).
On 29/06/2023 01:17, Kenneth Wolcott wrote:
> Hi Luke;
>
> Thank you for more information.
>
> This looks a little bit deeper than I feel comfortable :-(
>
> I'll think about this a bit more and experiment further, but this is definitely in uncharted territory for me.
>
It';s really not, you need to run sdl2-config --cflags and --libs to get
the set of flags, do that and report back here with the results.
Hello Pascal,
Thank you for this contribution. Here are some comments:
- since UTFString is a class ("a tagged record type"), why don't you create an abstract root "UXString" and then derive specialized object types ? Like UTF_8_XString, UTF_16_XString, ASCII_XString, Win_1252_XString, Latin_XString, etc.
- The default format to convert between different encodings should be UTF-8 as it is now ubiquitous.
> [...] moreover in the case of strings accentuated in French and strings containing emojis the process times are also improved (factor 7 to 8 by compared to UXStrings1
- I find quite astonishing to have a factor 8 compared to UTF-8 encoding. Do you have an explanation ? This looks like a poor implementation because UTF-8 encoding is fast and allows direct manipulation in most cases. Maybe because random access is treated as sequential access for UTF-8 encoded strings but this again is poor implementation.
Kind regards,
Vincent
On Wednesday, June 28, 2023 at 3:45:41 PM UTC-7, Luke A. Guest wrote:
> On 28/06/2023 22:53, Kenneth Wolcott wrote:
>
> >> I heavily use MacPorts. I keep hearing that it is a very bad idea to have MacPorts and HomeBrew concurrently installed on the same machine. Is it at all possible to do this without HomeBrew? Apparently I did not read your documentation carefully enough...I thought that having SDL installed via HomeBrew was optional, not required.
> I didn't get it working on Mac myself, I originally started to get it
> going using the downloadable binaries you can just drag n drop.
>
> Others got it working with brew, afaik.
> > Since I'm not using ALIRE (ALR), but using gnatmake (I'm on a Mac mini with an M1 chip, ALR refuses to get most packages because I don't have a native Ada compiler), I thought that the HomeBrew mention was in regards to using the SDLAda package via ALIRE.
> >
> > So that's a different problem requiring a different post :-)
> You're probably better off using git to grab it, then modify the
> makefile and gpr's for a specific macos macports port, add a new
> Platform_Type, macosx_macports and add what you need inside the sdlada.gpr.
>
> Then you can call make SDL_PLATFORM=macosx_macports SDL_MODE=release to
> build it.
>
> Check whatever sdl2-config --cflags produces on that port.
>
> If the headers are in different directories, you'll need to modify the
> version*.c files with extra #ifdef's for macports.
Hi Luke;
Thank you for more information.
This looks a little bit deeper than I feel comfortable :-(
I'll think about this a bit more and experiment further, but this is definitely in uncharted territory for me.
Thanks,
Ken
On 28/06/2023 22:53, Kenneth Wolcott wrote: >> I heavily use MacPorts. I keep hearing that it is a very bad idea to have MacPorts and HomeBrew concurrently installed on the same machine. Is it at all possible to do this without HomeBrew? Apparently I did not read your documentation carefully enough...I thought that having SDL installed via HomeBrew was optional, not required. I didn't get it working on Mac myself, I originally started to get it going using the downloadable binaries you can just drag n drop. Others got it working with brew, afaik. > Since I'm not using ALIRE (ALR), but using gnatmake (I'm on a Mac mini with an M1 chip, ALR refuses to get most packages because I don't have a native Ada compiler), I thought that the HomeBrew mention was in regards to using the SDLAda package via ALIRE. > > So that's a different problem requiring a different post :-) You're probably better off using git to grab it, then modify the makefile and gpr's for a specific macos macports port, add a new Platform_Type, macosx_macports and add what you need inside the sdlada.gpr. Then you can call make SDL_PLATFORM=macosx_macports SDL_MODE=release to build it. Check whatever sdl2-config --cflags produces on that port. If the headers are in different directories, you'll need to modify the version*.c files with extra #ifdef's for macports.
On Wednesday, June 28, 2023 at 2:18:36 PM UTC-7, Kenneth Wolcott wrote:
> On Wednesday, June 28, 2023 at 2:14:00 PM UTC-7, Luke A. Guest wrote:
> > On 28/06/2023 19:38, Kenneth Wolcott wrote:
> > > Hi;
> > >
> > > Trying to build SDL Ada on a Mac Mini with M1 chip, running Ventura 13.4.1...
> > >
> > > sudo make DESTDIR=/opt/ext_ada_lib/sdlada SDL_PLATFORM=macosx SDL_MODE=release
> > > mkdir -p gen/src/
> > > gprbuild -p -gnat2012 -XSDL_MODE=release -XSDL_PLATFORM=macosx \
> > > -Psdlada.gpr
> > > Compile
> > > [C] version_ttf.c
> > > [redacted]/Ada/from_GitHub/sdlada-master/src/ttf/version_ttf.c:27:18: fatal error: SDL2_ttf/SDL_ttf.h: No such file or directory
> > > 27 | #include <SDL2_ttf/SDL_ttf.h>
> > > | ^~~~~~~~~~~~~~~~~~~~
> > > compilation terminated.
> > > gprbuild: *** compilation phase failed
> > > make: *** [lib/libadasdl.a] Error 4
> > Have you installed sdl ttf with brew? I cannot confirm this all works
> > without brew.
> Hi Luke;
>
> I heavily use MacPorts. I keep hearing that it is a very bad idea to have MacPorts and HomeBrew concurrently installed on the same machine. Is it at all possible to do this without HomeBrew? Apparently I did not read your documentation carefully enough...I thought that having SDL installed via HomeBrew was optional, not required.
>
> Thanks,
> Ken
Since I'm not using ALIRE (ALR), but using gnatmake (I'm on a Mac mini with an M1 chip, ALR refuses to get most packages because I don't have a native Ada compiler), I thought that the HomeBrew mention was in regards to using the SDLAda package via ALIRE.
So that's a different problem requiring a different post :-)
Thanks,
Ken
On Wednesday, June 28, 2023 at 2:14:00 PM UTC-7, Luke A. Guest wrote:
> On 28/06/2023 19:38, Kenneth Wolcott wrote:
> > Hi;
> >
> > Trying to build SDL Ada on a Mac Mini with M1 chip, running Ventura 13.4.1...
> >
> > sudo make DESTDIR=/opt/ext_ada_lib/sdlada SDL_PLATFORM=macosx SDL_MODE=release
> > mkdir -p gen/src/
> > gprbuild -p -gnat2012 -XSDL_MODE=release -XSDL_PLATFORM=macosx \
> > -Psdlada.gpr
> > Compile
> > [C] version_ttf.c
> > [redacted]/Ada/from_GitHub/sdlada-master/src/ttf/version_ttf.c:27:18: fatal error: SDL2_ttf/SDL_ttf.h: No such file or directory
> > 27 | #include <SDL2_ttf/SDL_ttf.h>
> > | ^~~~~~~~~~~~~~~~~~~~
> > compilation terminated.
> > gprbuild: *** compilation phase failed
> > make: *** [lib/libadasdl.a] Error 4
> Have you installed sdl ttf with brew? I cannot confirm this all works
> without brew.
Hi Luke;
I heavily use MacPorts. I keep hearing that it is a very bad idea to have MacPorts and HomeBrew concurrently installed on the same machine. Is it at all possible to do this without HomeBrew? Apparently I did not read your documentation carefully enough...I thought that having SDL installed via HomeBrew was optional, not required.
Thanks,
Ken
On 28/06/2023 19:38, Kenneth Wolcott wrote:
> Hi;
>
> Trying to build SDL Ada on a Mac Mini with M1 chip, running Ventura 13.4.1...
>
> sudo make DESTDIR=/opt/ext_ada_lib/sdlada SDL_PLATFORM=macosx SDL_MODE=release
> mkdir -p gen/src/
> gprbuild -p -gnat2012 -XSDL_MODE=release -XSDL_PLATFORM=macosx \
> -Psdlada.gpr
> Compile
> [C] version_ttf.c
> [redacted]/Ada/from_GitHub/sdlada-master/src/ttf/version_ttf.c:27:18: fatal error: SDL2_ttf/SDL_ttf.h: No such file or directory
> 27 | #include <SDL2_ttf/SDL_ttf.h>
> | ^~~~~~~~~~~~~~~~~~~~
> compilation terminated.
> gprbuild: *** compilation phase failed
> make: *** [lib/libadasdl.a] Error 4
Have you installed sdl ttf with brew? I cannot confirm this all works
without brew.
On Wednesday, June 28, 2023 at 12:02:16 PM UTC-7, Jeffrey R.Carter wrote:
> On 2023-06-28 20:25, Kenneth Wolcott wrote:
> > On Wednesday, June 28, 2023 at 12:20:09 AM UTC-7, Jeffrey R.Carter wrote:
> >> On 2023-06-28 01:44, Kenneth Wolcott wrote:
> >>>
> >>> 1. Where do I place the SDL library from GitHub?
> >> That is up to you. It goes in /path/to/SDL/, where you choose /path/to/.
> >
> > Cool.
> I probably should have mentioned that the library build procedure may expect a
> specific directory structure under /path/to/SDL/, and failure to create/keep
> that may result in the build process failing.
> > I'm not sure I understand the distinction between "-I/path" and "-L/path". I think when one includes ("-I/path") something it will be compiled along with what I'm trying to compile and when I use "-L/path" it means use *.obj, *.ali, etc at the linking stage. Is that correct?
> From the GNAT user guide
> (https://docs.adacore.com/live/wave/gnat_ugn/html/gnat_ugn/gnat_ugn/building_executable_programs_with_gnat.html#switches-for-gnatmake),
> -I/path/ is equivalent to -aO/path/ -aI/path/. -aO/path/ says to look for
> library and object files (.ali & .o) in /path/ in addition to the current
> directory. -aI/path/ says to look for source files in /path/ in addition to the
> current directory.
>
> -L/path/ is equivalent to -largs -L/path/, so it's a linker switch.
>
> I should probably have mentioned that it's probably a good idea to write-protect
> the library's .ali files one the library is built. This prevents other
> compilations from recompiling the library.
>
> In my experience, if you have the library's source, .ali, and .o files in
> /path/, then -I/path/ is all you need to compile and link against the library.
Thank you for the clarification/elaboration.
Ken
On 2023-06-28 20:25, Kenneth Wolcott wrote: > On Wednesday, June 28, 2023 at 12:20:09 AM UTC-7, Jeffrey R.Carter wrote: >> On 2023-06-28 01:44, Kenneth Wolcott wrote: >>> >>> 1. Where do I place the SDL library from GitHub? >> That is up to you. It goes in /path/to/SDL/, where you choose /path/to/. > > Cool. I probably should have mentioned that the library build procedure may expect a specific directory structure under /path/to/SDL/, and failure to create/keep that may result in the build process failing. > I'm not sure I understand the distinction between "-I/path" and "-L/path". I think when one includes ("-I/path") something it will be compiled along with what I'm trying to compile and when I use "-L/path" it means use *.obj, *.ali, etc at the linking stage. Is that correct? From the GNAT user guide (https://docs.adacore.com/live/wave/gnat_ugn/html/gnat_ugn/gnat_ugn/building_executable_programs_with_gnat.html#switches-for-gnatmake), -I/path/ is equivalent to -aO/path/ -aI/path/. -aO/path/ says to look for library and object files (.ali & .o) in /path/ in addition to the current directory. -aI/path/ says to look for source files in /path/ in addition to the current directory. -L/path/ is equivalent to -largs -L/path/, so it's a linker switch. I should probably have mentioned that it's probably a good idea to write-protect the library's .ali files one the library is built. This prevents other compilations from recompiling the library. In my experience, if you have the library's source, .ali, and .o files in /path/, then -I/path/ is all you need to compile and link against the library. -- Jeff Carter "He nevere yet no vileynye ne sayde In al his lyf unto no maner wight." Canterbury Tales 156
Hi; Trying to build SDL Ada on a Mac Mini with M1 chip, running Ventura 13.4.1... sudo make DESTDIR=/opt/ext_ada_lib/sdlada SDL_PLATFORM=macosx SDL_MODE=release mkdir -p gen/src/ gprbuild -p -gnat2012 -XSDL_MODE=release -XSDL_PLATFORM=macosx \ -Psdlada.gpr Compile [C] version_ttf.c [redacted]/Ada/from_GitHub/sdlada-master/src/ttf/version_ttf.c:27:18: fatal error: SDL2_ttf/SDL_ttf.h: No such file or directory 27 | #include <SDL2_ttf/SDL_ttf.h> | ^~~~~~~~~~~~~~~~~~~~ compilation terminated. gprbuild: *** compilation phase failed make: *** [lib/libadasdl.a] Error 4 Thanks, Ken Wolcott
On Wednesday, June 28, 2023 at 12:20:09 AM UTC-7, Jeffrey R.Carter wrote: > On 2023-06-28 01:44, Kenneth Wolcott wrote: > > > > 1. Where do I place the SDL library from GitHub? > That is up to you. It goes in /path/to/SDL/, where you choose /path/to/. Cool. > > 2. Do I compile/install the package? > The library may have specific compilation/installation instructions. Generally > you should follow those. Ok. > > 3. When using gnatmake do I use -I to specify where the library I'm referencing is found? > This depends on the answer to 2. If you have all the source files for the > library in /path/to/SDL/, and have compiled them so their .ali and .o files are > also there, then using -I/path/to/SDL/ works fine. This is simple and easy. As > S/W engineers always try to keep things as simple as possible, this is the > approach I tend to use. Use "-I/path", but do not use "-L/path"? > Coders, on the other hand, like to introduce unnecessary complexity, and you > will find lots of projects with baroque directory structures, maybe with source > files in /path/to/SDL/src/, .ali and .o files in /path/to/SDL/lib/, test program > source files in /path/to/SDL/test/src, their .ali and .o files in > /path/to/SDL/test/lib/, and executables in /path/to/SDL/test/bin/. Such > directory structures are gnatmake unfriendly, and the simple -I approach doesn't > work. You'll have to look into the exact meaning of -I and -a, and maybe others. Yeah, I like to keep things simple as well :-) I'm not sure I understand the distinction between "-I/path" and "-L/path". I think when one includes ("-I/path") something it will be compiled along with what I'm trying to compile and when I use "-L/path" it means use *.obj, *.ali, etc at the linking stage. Is that correct? > > 4. Once #3 is answered, I assume that I "with package" as if the '*.ad[sb]' files were co-located with my Ada program, is that correct? > The Ada language definition is independent of how and where source and > compilation artifacts are stored, so context clauses are necessarily independent > of such concepts. In other words, yes. This kind of information is handled by > the compilation options such as -I. Thank you for the info! Now I will make a new post regarding the compilation error I received with the SDL package. Thanks, Ken Wolcott > -- > Jeff Carter > "He nevere yet no vileynye ne sayde > In al his lyf unto no maner wight." > Canterbury Tales > 156
Hi all, this message contains the final time of the meeting, connection details and other info. The first “official” Ada Monthly Meetup will take place this Saturday, 1st of July, at 13:00 UTC Time. That corresponds to 15:00 CET (Central European Time: Madrid, Paris, Berlin, Rome…). The meetup will take place over at Jitsi, a conferencing software that runs on any modern browser. The link is https://meet.jit.si/AdaMonthlyMeetup The room name is “AdaMonthlyMeetup” and in case it asks for a password, it will be set to “AdaRules”. I do not want to set up a password, but in case it is needed, it will be the one above without the quotes. The room name is generally not needed as the link should take you directly there, but I want to write it down just in case someone needs it. Talks: No one proposed any topics, but there was a proposal that I quite liked! An Ada user told me they would like for people to present themselves with a brief introduction so that listeners and other new users could tell who is who. I think this is a great idea as that allows the community to get closer together, know who is who and what they work on and have a better understanding of the speakers and their background. Obviously, this will be optional, nobody will be forced to do this in any kind of way. The introductions should be short (think 30s to a minute) and I will be the first one to do it to help break the ice :smiley: If I forgot something, please, point it out so that any issues can get patched out. Notice! The link to the room has been changed to be more “universal”. So please, share it with people who received the old link. Another point is that the password, in case it is needed, has also changed. I sadly cannot block the room with a password unless a moderator in connected. This means that there is a very unlikely chance someone could vandalise the room, but I do not expect this to be a problem. Also the presentation will not be streamed just yet. I did not have time to test it but Maxim kindly agreed to help, so that will be coming down the line. Best regards, Fer P.S: I, Fer, will post this over at the C.L.A and Ada-Lang.io . Feel free to repost this to Reddit, Gitter/Matrix, Telegram or any other channels! The more people know about this, the better (I hope).
On 2023-06-28 01:44, Kenneth Wolcott wrote: > > 1. Where do I place the SDL library from GitHub? That is up to you. It goes in /path/to/SDL/, where you choose /path/to/. > 2. Do I compile/install the package? The library may have specific compilation/installation instructions. Generally you should follow those. > 3. When using gnatmake do I use -I to specify where the library I'm referencing is found? This depends on the answer to 2. If you have all the source files for the library in /path/to/SDL/, and have compiled them so their .ali and .o files are also there, then using -I/path/to/SDL/ works fine. This is simple and easy. As S/W engineers always try to keep things as simple as possible, this is the approach I tend to use. Coders, on the other hand, like to introduce unnecessary complexity, and you will find lots of projects with baroque directory structures, maybe with source files in /path/to/SDL/src/, .ali and .o files in /path/to/SDL/lib/, test program source files in /path/to/SDL/test/src, their .ali and .o files in /path/to/SDL/test/lib/, and executables in /path/to/SDL/test/bin/. Such directory structures are gnatmake unfriendly, and the simple -I approach doesn't work. You'll have to look into the exact meaning of -I and -a, and maybe others. > 4. Once #3 is answered, I assume that I "with package" as if the '*.ad[sb]' files were co-located with my Ada program, is that correct? The Ada language definition is independent of how and where source and compilation artifacts are stored, so context clauses are necessarily independent of such concepts. In other words, yes. This kind of information is handled by the compilation options such as -I. -- Jeff Carter "He nevere yet no vileynye ne sayde In al his lyf unto no maner wight." Canterbury Tales 156
Hi; Very basic question here. I have downloaded several examples of Ada code from the Rosetta Code web site. Some very interesting stuff! I'm on a Mac with an M1 chip using the gnat 13.1 compiler from Simon Wright... I see many of these Rsoetta Code examples refer to external libraries (SDL, XML, GTK, etc). I have found most under ALIRE. I have found most of them in GitHub (etc). I'm not using ALR much yet because I can't seem to successfully get full crates because I'm using an external gnat compiler (I'm on a Mac with a M1 chip) and it seems to only like crates bundled with the compiler on ALR :-( That is a question for a different post... So, my questions are: 1. Where do I place the SDL library from GitHub? 2. Do I compile/install the package? 3. When using gnatmake do I use -I to specify where the library I'm referencing is found? 4. Once #3 is answered, I assume that I "with package" as if the '*.ad[sb]' files were co-located with my Ada program, is that correct? Thanks, Ken Wolcott
Hello again all, In the hope it might help other people building or OS packaging GnatStudio, I've prepared a 'cookbook' of sorts. It provides build instructions for the entire GnatStudio project stack, beginning with gprbuild-bootstrap and culminating in the build of gnatstudio. The individual 'recipes' take the form of pacman PKGBUILDs with tarballs and patches. Here is the link ... https://github.com/charlie5/archlinux-gnatstudio-support/tree/main/gnatstudio-cookbook Regards.
On 5/6/23 22:55, Rod Kay wrote:
> On 5/6/23 20:15, Maxim Reznik wrote:
>> Great! Waiting for GNAT Studio in Arch Linux :)
>>
>
> I still have one problem to solve. When I run GS, i get the
> following python error ...
>
> Fatal Python error: init_fs_encoding: failed to get the Python codec of
> the filesystem encoding
> Python runtime state: core initialized
> ModuleNotFoundError: No module named 'encodings'
>
It turns out that gnatstudio expects '/usr/share/gnatstudio/python'
to contain or point to the root of an OS's python installation. So a
simple soft link to '/usr' fixed this problem.
The only other problem was a deprecated python module, which was
very easy to patch/fix.
So now gnatstudio builds/runs on Archlinux with all the bells/whistles.
A final thanks, Maxim, for your help.
Regards.
On 2023-06-26 23:42, Randy Brukardt wrote: > > B_String is an unconstrained type, which technically has a "null constraint" > (see 3.2(7/2), rather unfortuate terminology, IMHO(. These always statically > match, so they're always statically compatible as well. It's also a limited type, so the discriminant can never be changed, which is why I was unsure if the deferred constant was considered constrained. > So this appears to be a compiler bug. It might be related to the relatively > new rule that Object_Size must match for static matching to work -- but that > only applies to non-default Object_Size values (and there are none of those > given here). Thanks for looking at this. I'll have to find out how to report an error in FSF GNAT. -- Jeff Carter "It has been my great privilege, many years ago, whilst traveling through the mountains of Paraguay, to find the Yack'Wee Indians drinking the juice of the cacti." The Old Fashioned Way 152
"Jeffrey R.Carter" <spam.jrcarter.not@spam.acm.org.not> wrote in message
news:u76n8o$3873$1@dont-email.me...
> On 2023-06-23 11:55, Randy Brukardt wrote:
>>
>> Sigh. :Let's start over. My theory was that the problem came from an
>> attempt
>> by AdaCore to implement AI22-0041-1, a post Ada-2022 binding
>> interpretation.
>> That AI adds a static compatibility requirement to 7.4(6/3) (making it
>> 7.4(6/6)). (It of course could just be a bug, too, but AI22-0041-1 seems
>> like the only sane reason to be changing the matching code in a working
>> compiler that passes the ACATS.)
>>
>> There is *no* version of the RM currently that includes the wording from
>> post-Ada 2022 AIs (because of we had to wait for ISO to publish the thing
>> first). You can only find that in the >50 approved AIs.
>
> Thanks for this clarification. I didn't realize I would have to look at
> the AI itself. I'm using -gnat12, in hopes that the Ada-12 rules would be
> applied, but that doesn't seem to work.
>
> [New version of 7.4(6):]
>
>> a.. If the deferred constant declaration includes a subtype_indication
>> that defines a subtype S1, then the subtype_indication in the full
>> declaration shall define a subtype S2 that is statically compatible with
>> S1
>> (see 4.9.1). If S1 is a constrained subtype, the constraint defined by S2
>> shall statically match the constraint defined by S1. [Redundant: If the
>> subtype S1 of the deferred constant is unconstrained, then the full
>> declaration is still allowed to impose a constraint.]
>
> As my case doesn't involve the concepts involved in the other PPs, aliased
> and null exclusion, I presume that this PP applies. The essential parts of
> the code are
>
> type B_String (Max_Length : Positive := 1_000) is tagged limited
> private;
> Null_B_String : constant B_String;
> ...
> Null_B_String : constant B_String := (Max_Length => 1, others => <>);
>
> I would think that the subtype indications in the two, being identical,
> would be statically compatible. But my understanding of this may be wrong.
>
> I'm not sure whether the deferred declaration has a constrained subtype,
> which would result in the constraint from the initialization expression of
> the full declaration not matching. But that rule has existed since Ada 95.
>
> I think it would be a mistake for the language to require explicit
> discriminant associations for this case.
>
> So I'm still not able to tell if this is a compiler error or intended by
> the language.
A subtype is always supposed to statically match itself (even though that
isn't clear from them RM wording).
B_String is an unconstrained type, which technically has a "null constraint"
(see 3.2(7/2), rather unfortuate terminology, IMHO(. These always statically
match, so they're always statically compatible as well.
So this appears to be a compiler bug. It might be related to the relatively
new rule that Object_Size must match for static matching to work -- but that
only applies to non-default Object_Size values (and there are none of those
given here).
Randy.
Simon;
> The package in the compiler that deals with crunched names is Rtsfind,
> https://github.com/gcc-mirror/gcc/blob/master/gcc/ada/rtsfind.ads
Thank you!
Ken
Jere <jhb.chat@gmail.com> writes: > On Sunday, June 25, 2023 at 5:49:11 PM UTC-4, Keith Thompson wrote: >> Simon Wright writes: >> [...] >> > But you say you know that. I wonder whether it's the crunched filenames >> > that are confusing? (a legacy of the days when DOS 8.3 filenames were >> > required for a large part of GNAT's target audience). You can find the >> > crunched filename for a package using gnatkr (gnat krunch): >> > >> > $ gnatkr ada.sequential_io.ads >> [fixed typo] >> > a-sequio.ads >> > >> > (you don't actually need whatever's after the final period to be the >> > actual file extension: you could use '.open' or just '.'). >> Which raises a question: Why does GNAT still use crunched filenames? It >> probably makes sense to continue to support them (does anyone use GNAT >> on MS-DOS?), but I wouldn't think it would be difficult to use full file >> names on the vast majority of systems that support them. It's not a >> huge deal, but using full file names where possible would be less >> annoying. > > Unless they changed how the GNAT compiler works in the last few years, > then my guess is inertia > to do that. Right before the pandemic hit, I had the neat idea of > doing my own bare metal > runtime and to use normal uncrunched names. The RTS compiled just > fine doing that. However, > when I tried to use the RTS to build a full fledged program, it failed > to find the package in the RTS. > I don't recall if it failed at compile time or link time, but > crunching the names and recompiling the > RTS fixed the issue. So something in their compiler requires the > crunched names, or if they have > since changed that, used to require it. The package in the compiler that deals with crunched names is Rtsfind, https://github.com/gcc-mirror/gcc/blob/master/gcc/ada/rtsfind.ads
> Simon Wright writes:
> $ gnatkr ada.sequential_io.ads
> a-sequio.ads
Simon, Keith, Jere:
Yes, the crunched names are annoying. Too bad that they seem to be required even now...
I'm now writing a Perl script (later to be converted to Ada) which does the "unkrunch" :-)
Seems like a missing utility for humans to use Ada :-)
Thanks,
Ken
On Sunday, June 25, 2023 at 5:49:11 PM UTC-4, Keith Thompson wrote:
> Simon Wright writes:
> [...]
> > But you say you know that. I wonder whether it's the crunched filenames
> > that are confusing? (a legacy of the days when DOS 8.3 filenames were
> > required for a large part of GNAT's target audience). You can find the
> > crunched filename for a package using gnatkr (gnat krunch):
> >
> > $ gnatkr ada.sequential_io.ads
> [fixed typo]
> > a-sequio.ads
> >
> > (you don't actually need whatever's after the final period to be the
> > actual file extension: you could use '.open' or just '.').
> Which raises a question: Why does GNAT still use crunched filenames? It
> probably makes sense to continue to support them (does anyone use GNAT
> on MS-DOS?), but I wouldn't think it would be difficult to use full file
> names on the vast majority of systems that support them. It's not a
> huge deal, but using full file names where possible would be less
> annoying.
Unless they changed how the GNAT compiler works in the last few years, then my guess is inertia
to do that. Right before the pandemic hit, I had the neat idea of doing my own bare metal
runtime and to use normal uncrunched names. The RTS compiled just fine doing that. However,
when I tried to use the RTS to build a full fledged program, it failed to find the package in the RTS.
I don't recall if it failed at compile time or link time, but crunching the names and recompiling the
RTS fixed the issue. So something in their compiler requires the crunched names, or if they have
since changed that, used to require it.
Simon Wright <simon@pushface.org> writes: [...] > But you say you know that. I wonder whether it's the crunched filenames > that are confusing? (a legacy of the days when DOS 8.3 filenames were > required for a large part of GNAT's target audience). You can find the > crunched filename for a package using gnatkr (gnat krunch): > > $ gnatkr ada.sequential_io.ads [fixed typo] > a-sequio.ads > > (you don't actually need whatever's after the final period to be the > actual file extension: you could use '.open' or just '.'). Which raises a question: Why does GNAT still use crunched filenames? It probably makes sense to continue to support them (does anyone use GNAT on MS-DOS?), but I wouldn't think it would be difficult to use full file names on the vast majority of systems that support them. It's not a huge deal, but using full file names where possible would be less annoying. -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com Will write code for food. void Void(void) { Void(); } /* The recursive call of the void */
Thank you Simon! On Sunday, June 25, 2023 at 3:15:54 AM UTC-7, Simon Wright wrote: > Kenneth Wolcott writes: > > > I have gnat 13.1.0 on my M1 Mac; > > > > (thank you, Simon! <GRIN>) > :bow: > > I'd like to have my own Ada+GNAT *.ad[sb] library files, where are they? > If you just want to insect them, see below: if you want to alter them, > that'd be a bit tricker. As far as I can remember, GNAT Pro releases > provide for rebuilding the runtime, but the FSF builds don't. > > I can find the Ada libraries (*.ad[sb]) but it sometimes is hard to > > (reliably) find all of the GNAT Ada libraries in external > > documentation. > They're in {prefix}/lib/gcc/{target}/{release}/adainclude/ - i.e., in > your case (unless you've moved the install) > > /opt/gcc-13.1.0-aarch64/lib/gcc/aarch64-apple-darwin21/13.1.0/adainclude/ This is all the information that I needed, thank you! > But you say you know that. I wonder whether it's the crunched filenames > that are confusing? (a legacy of the days when DOS 8.3 filenames were > required for a large part of GNAT's target audience). You can find the > crunched filename for a package using gnatkr (gnat krunch): > > $ gnatkr gnatkr ada.sequential_io.ads > a-sequio.ads This is nice, thank you! > (you don't actually need whatever's after the final period to be the > actual file extension: you could use '.open' or just '.'). Ken Wolcott
Simon Wright <simon@pushface.org> writes:
> $ gnatkr gnatkr ada.sequential_io.ads
> a-sequio.ads
Only one 'gnatkr', ofc!
Kenneth Wolcott <kennethwolcott@gmail.com> writes: > I have gnat 13.1.0 on my M1 Mac; > > (thank you, Simon! <GRIN>) :bow: > I'd like to have my own Ada+GNAT *.ad[sb] library files, where are they? If you just want to insect them, see below: if you want to alter them, that'd be a bit tricker. As far as I can remember, GNAT Pro releases provide for rebuilding the runtime, but the FSF builds don't. > I can find the Ada libraries (*.ad[sb]) but it sometimes is hard to > (reliably) find all of the GNAT Ada libraries in external > documentation. They're in {prefix}/lib/gcc/{target}/{release}/adainclude/ - i.e., in your case (unless you've moved the install) /opt/gcc-13.1.0-aarch64/lib/gcc/aarch64-apple-darwin21/13.1.0/adainclude/ But you say you know that. I wonder whether it's the crunched filenames that are confusing? (a legacy of the days when DOS 8.3 filenames were required for a large part of GNAT's target audience). You can find the crunched filename for a package using gnatkr (gnat krunch): $ gnatkr gnatkr ada.sequential_io.ads a-sequio.ads (you don't actually need whatever's after the final period to be the actual file extension: you could use '.open' or just '.').
On Saturday, June 24, 2023 at 9:37:37 PM UTC-7, Kenneth Wolcott wrote:
> Hi;
>
> I have gnat 13.1.0 on my M1 Mac;
>
> (thank you, Simon! <GRIN>)
>
> I'd like to have my own Ada+GNAT *.ad[sb] library files, where are they?
>
> I can find the Ada libraries (*.ad[sb]) but it sometimes is hard to (reliably) find all of the GNAT Ada libraries in external documentation.
>
> I hope that this is not a stupid question.
>
> Perhaps there is a gnatmake flag or gnat doc that I'm just not seeing.
>
> Thanks,
> Ken Wolcott
Hi; I have gnat 13.1.0 on my M1 Mac; (thank you, Simon! <GRIN>) I'd like to have my own Ada+GNAT *.ad[sb] library files, where are they? I can find the Ada libraries (*.ad[sb]) but it sometimes is hard to (reliably) find all of the GNAT Ada libraries in external documentation. I hope that this is not a stupid question. Perhaps there is a gnatmake flag or gnat doc that I'm just not seeing. Thanks, Ken Wolcott
On 2023-06-23 11:55, Randy Brukardt wrote: > > Sigh. :Let's start over. My theory was that the problem came from an attempt > by AdaCore to implement AI22-0041-1, a post Ada-2022 binding interpretation. > That AI adds a static compatibility requirement to 7.4(6/3) (making it > 7.4(6/6)). (It of course could just be a bug, too, but AI22-0041-1 seems > like the only sane reason to be changing the matching code in a working > compiler that passes the ACATS.) > > There is *no* version of the RM currently that includes the wording from > post-Ada 2022 AIs (because of we had to wait for ISO to publish the thing > first). You can only find that in the >50 approved AIs. Thanks for this clarification. I didn't realize I would have to look at the AI itself. I'm using -gnat12, in hopes that the Ada-12 rules would be applied, but that doesn't seem to work. [New version of 7.4(6):] > a.. If the deferred constant declaration includes a subtype_indication > that defines a subtype S1, then the subtype_indication in the full > declaration shall define a subtype S2 that is statically compatible with S1 > (see 4.9.1). If S1 is a constrained subtype, the constraint defined by S2 > shall statically match the constraint defined by S1. [Redundant: If the > subtype S1 of the deferred constant is unconstrained, then the full > declaration is still allowed to impose a constraint.] As my case doesn't involve the concepts involved in the other PPs, aliased and null exclusion, I presume that this PP applies. The essential parts of the code are type B_String (Max_Length : Positive := 1_000) is tagged limited private; Null_B_String : constant B_String; ... Null_B_String : constant B_String := (Max_Length => 1, others => <>); I would think that the subtype indications in the two, being identical, would be statically compatible. But my understanding of this may be wrong. I'm not sure whether the deferred declaration has a constrained subtype, which would result in the constraint from the initialization expression of the full declaration not matching. But that rule has existed since Ada 95. I think it would be a mistake for the language to require explicit discriminant associations for this case. So I'm still not able to tell if this is a compiler error or intended by the language. -- Jeff Carter "Insufficient laughter--that's grounds for divorce." Play It Again, Sam 126
Recently Linux Fedora and Ubuntu distributions stopped ARMv7 support (32-bit). I added 64-bit architecture to the repositories of the following libraries for Debian, Fedora and Ubuntu: - Ada industrial control widget library http://www.dmitry-kazakov.de/ada/aicwl.htm - Fuzzy machine learning framework http://www.dmitry-kazakov.de/ada/fuzzy_ml.htm - Fuzzy sets, logic, numbers http://www.dmitry-kazakov.de/ada/fuzzy.htm - GtkAda (pre-built) http://www.dmitry-kazakov.de/ada/gtkada.htm - GtkAda contributions http://www.dmitry-kazakov.de/ada/gtkada_contributions.htm - MAX! cube GUI for management of indoor radiator thermostats http://www.dmitry-kazakov.de/ada/max_home_automation.htm - Interval arithmetic http://www.dmitry-kazakov.de/ada/intervals.htm - Measurement units http://www.dmitry-kazakov.de/ada/units.htm - Simple component http://www.dmitry-kazakov.de/ada/components.htm - String editing, UTF-8 issues http://www.dmitry-kazakov.de/ada/strings_edit.htm - Table management http://www.dmitry-kazakov.de/ada/tables.htm ARMv7 builds are continued for the last official releases of the corresponding OSes. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
"Jeffrey R.Carter" <spam.jrcarter.not@spam.acm.org.not> wrote in message
news:u71gea$38ekv$1@dont-email.me...
> On 2023-06-22 11:51, Randy Brukardt wrote:
>> You missed my point: The requirement that the subtypes are statically
>> compatible was newly added. That applies to *all* subtypes, not just
>> those
>> with predicates. The reason the requirement was added had to do with
>> predicates, but it might affect some marginal cases beyond that. It's a
>> weaker requirement than static matching, but stronger than no requirement
>> at
>> all.
>>
>> As I said the other day, you need to check if 4.9.1 allows or disallows
>> your
>> example (that's where the definition of static compatibility is found).
>> If
>> it allows it, then it's a compiler bug, if it doesn't allow it, it's an
>> incompatibility with a language fix and you need to find a different way
>> to
>> do whatever it is you are doing.
>
> Sorry, but I think you're wrong. The problem isn't static compatibility;
> it's static matching. The error msg says the subtypes must statically
> match, and the wording in 7.4(6/3) for deferred constants (which this is)
> refers to statically matching constraints. So static compatibility doesn't
> seem to be the issue.
Sigh. :Let's start over. My theory was that the problem came from an attempt
by AdaCore to implement AI22-0041-1, a post Ada-2022 binding interpretation.
That AI adds a static compatibility requirement to 7.4(6/3) (making it
7.4(6/6)). (It of course could just be a bug, too, but AI22-0041-1 seems
like the only sane reason to be changing the matching code in a working
compiler that passes the ACATS.)
There is *no* version of the RM currently that includes the wording from
post-Ada 2022 AIs (because of we had to wait for ISO to publish the thing
first). You can only find that in the >50 approved AIs.
To save you the effort of looking up AI22-0041-1, here is the entire wording
section from that AI:
Replace 7.4(6/3) :
a.. If the deferred constant declaration includes a subtype_indication S
that defines a constrained subtype, then the constraint defined by the
subtype_indication in the full declaration shall match the constraint
defined by S statically. [Redundant: On the other hand, if the subtype of
the deferred constant is unconstrained, then the full declaration is still
allowed to impose a constraint. The constant itself will be constrained,
like all constants;]
with:
a.. If the deferred constant declaration includes a subtype_indication
that defines a subtype S1, then the subtype_indication in the full
declaration shall define a subtype S2 that is statically compatible with S1
(see 4.9.1). If S1 is a constrained subtype, the constraint defined by S2
shall statically match the constraint defined by S1. [Redundant: If the
subtype S1 of the deferred constant is unconstrained, then the full
declaration is still allowed to impose a constraint.]
Modify 7.4(7/2):
a.. If the deferred constant declaration contains the reserved word
aliased, then the full declaration shall also{.}[;]
Delete 7.4(7.1/2) [now covered by static compatibility]:
a.. If the subtype of the deferred constant declaration excludes null,
then the subtype of the full declaration shall also exclude null.
Note that this adds a requirement for static compatibility of the subtypes
for *all* deferred constant declarations. The AI also says that the separate
static matching requirement is unnecessary; it was left alone to avoid
making work for implementers in unlikely cases (it's weaker than static
matching for scalar types, but deferred constants are rarely scalar).
Note that static compatibility requires static matching in some cases, so it
could make sense to have the message say something about the types being
required to match. (The distinction between "static compatibility" and
"static matching" is lost on most people.)
Randy.
On 2023-06-22 11:51, Randy Brukardt wrote: > You missed my point: The requirement that the subtypes are statically > compatible was newly added. That applies to *all* subtypes, not just those > with predicates. The reason the requirement was added had to do with > predicates, but it might affect some marginal cases beyond that. It's a > weaker requirement than static matching, but stronger than no requirement at > all. > > As I said the other day, you need to check if 4.9.1 allows or disallows your > example (that's where the definition of static compatibility is found). If > it allows it, then it's a compiler bug, if it doesn't allow it, it's an > incompatibility with a language fix and you need to find a different way to > do whatever it is you are doing. Sorry, but I think you're wrong. The problem isn't static compatibility; it's static matching. The error msg says the subtypes must statically match, and the wording in 7.4(6/3) for deferred constants (which this is) refers to statically matching constraints. So static compatibility doesn't seem to be the issue. > I don't have the energy tonight to go > through that exercise myself (I apparently brought back a bug from Lisbon, > and have spent much of the last several days in bed - but for some reason I > seem to only be able to sleep during the day. Really louses up life...). Sorry to hear that. Hope you feel better soon. > "Jeffrey R.Carter" <spam.jrcarter.not@spam.acm.org.not> wrote in message > news:u6jtue$16d9e$1@dont-email.me... >> On 2023-06-17 09:28, Randy Brukardt wrote: >>> Regarding your second problem, refer to AI22-0041-1. >>> >>> Essentially, there are problems if predicates are involved. We changed >>> the >>> rule to require static compatibility (as a Binding Interpretation). I >>> don't >>> have the energy to look up what "static compatibility" requires in this >>> case >>> (enjoy figuring out 4.9.1). In some cases, it requires static matching, >>> in >>> others, it has weaker requirements. >> >> There are no predicates involved. One can cut it down to just the type and >> constant: >> >> package B_Strings_Prob is >> type B_String (Max_Length : Positive := 1_000) is tagged limited >> private; >> >> Null_B_String : constant B_String; -- A string of zero characters >> private -- B_Strings_Prob >> type B_String (Max_Length : Positive := 1_000) is tagged limited record >> Len : Natural := 0; >> Value : String (1 .. Max_Length) := (1 .. Max_Length => ' '); >> end record; >> >> Null_B_String : constant B_String := (Max_Length => 1, others => <>); >> end B_Strings_Prob; >> >> and still get the error: >> >> $ gnatmake -gnatc b_strings_prob.ads >> x86_64-linux-gnu-gcc-13 -c -gnatc b_strings_prob.ads >> b_strings_prob.ads:12:04: error: subtype does not statically match >> deferred declaration at line 5 >> gnatmake: "b_strings_prob.ads" compilation error >> >> I don't see any mention of AI22-0041-1 in ARM 7.4. >> >>> I don't have the time or energy tonight to look into your other problem. >>> (I'm waiting for a backup to finish, or I would have already gone home -- >>> since I only got back from Lisbon last night, I'm not equipped for my >>> usual >>> late night work...) >> >> I'm surprised you're this functional already. >> >> -- >> Jeff Carter >> "I was in love with a beautiful blonde once, dear. >> She drove me to drink. That's the one thing I'm >> indebted to her for." >> Never Give a Sucker an Even Break >> 109 >> > > -- Jeff Carter "[I]t is easy to use [Ada] just like any other language: using only predefined types, using packages just for separate compilation (without any consideration for information hiding), ignoring generics altogether, etc. I have seen projects doing this; they didn't get much gain from using Ada, and spent a lot of time fighting the compiler." Jean-Pierre Rosen 165
You missed my point: The requirement that the subtypes are statically
compatible was newly added. That applies to *all* subtypes, not just those
with predicates. The reason the requirement was added had to do with
predicates, but it might affect some marginal cases beyond that. It's a
weaker requirement than static matching, but stronger than no requirement at
all.
As I said the other day, you need to check if 4.9.1 allows or disallows your
example (that's where the definition of static compatibility is found). If
it allows it, then it's a compiler bug, if it doesn't allow it, it's an
incompatibility with a language fix and you need to find a different way to
do whatever it is you are doing. I don't have the energy tonight to go
through that exercise myself (I apparently brought back a bug from Lisbon,
and have spent much of the last several days in bed - but for some reason I
seem to only be able to sleep during the day. Really louses up life...).
Randy.
"Jeffrey R.Carter" <spam.jrcarter.not@spam.acm.org.not> wrote in message
news:u6jtue$16d9e$1@dont-email.me...
> On 2023-06-17 09:28, Randy Brukardt wrote:
>> Regarding your second problem, refer to AI22-0041-1.
>>
>> Essentially, there are problems if predicates are involved. We changed
>> the
>> rule to require static compatibility (as a Binding Interpretation). I
>> don't
>> have the energy to look up what "static compatibility" requires in this
>> case
>> (enjoy figuring out 4.9.1). In some cases, it requires static matching,
>> in
>> others, it has weaker requirements.
>
> There are no predicates involved. One can cut it down to just the type and
> constant:
>
> package B_Strings_Prob is
> type B_String (Max_Length : Positive := 1_000) is tagged limited
> private;
>
> Null_B_String : constant B_String; -- A string of zero characters
> private -- B_Strings_Prob
> type B_String (Max_Length : Positive := 1_000) is tagged limited record
> Len : Natural := 0;
> Value : String (1 .. Max_Length) := (1 .. Max_Length => ' ');
> end record;
>
> Null_B_String : constant B_String := (Max_Length => 1, others => <>);
> end B_Strings_Prob;
>
> and still get the error:
>
> $ gnatmake -gnatc b_strings_prob.ads
> x86_64-linux-gnu-gcc-13 -c -gnatc b_strings_prob.ads
> b_strings_prob.ads:12:04: error: subtype does not statically match
> deferred declaration at line 5
> gnatmake: "b_strings_prob.ads" compilation error
>
> I don't see any mention of AI22-0041-1 in ARM 7.4.
>
>> I don't have the time or energy tonight to look into your other problem.
>> (I'm waiting for a backup to finish, or I would have already gone home --
>> since I only got back from Lisbon last night, I'm not equipped for my
>> usual
>> late night work...)
>
> I'm surprised you're this functional already.
>
> --
> Jeff Carter
> "I was in love with a beautiful blonde once, dear.
> She drove me to drink. That's the one thing I'm
> indebted to her for."
> Never Give a Sucker an Even Break
> 109
>
On 21/06/2023 08:01, Guillermo Hazebrouck wrote:
> El martes, 20 de junio de 2023 a la(s) 23:27:20 UTC+2, Luke A. Guest escribió:
>> On 20/06/2023 14:31, Guillermo Hazebrouck wrote:
>>> El viernes, 24 de enero de 2014 a la(s) 00:48:07 UTC+1, Lucretia escribió:
>>>> I built arm and mipsel Android GNAT using the svn/git 4.9.0 branch of GCC.I had to add in mips, but it built. Not done anything with it yet.
>>>>
>>>> Luke.
>>> Do you still have this? Or could you explain how you created the toolchain?
>>> Guillermo
>> As a test, I updated my ndk and tried to compile both gcc 13 and 12,
>> both failed. 13 with Ghost aspects and 12 with missing headers.
>>
>> They've changed the structure of the sysroot and I don't know enough
>> about the android ndk anymore.
> Ok, thanks for that. I guess It will be more productive and future-proof to explore the LLVM option... Any clue about that? I understand a bit the logic of LLVM, but putting it into practice probably won't be ease.
AFAIK, just build the front end and then port the runtime.
El martes, 20 de junio de 2023 a la(s) 23:27:20 UTC+2, Luke A. Guest escribió:
> On 20/06/2023 14:31, Guillermo Hazebrouck wrote:
> > El viernes, 24 de enero de 2014 a la(s) 00:48:07 UTC+1, Lucretia escribió:
> >> I built arm and mipsel Android GNAT using the svn/git 4.9.0 branch of GCC.I had to add in mips, but it built. Not done anything with it yet.
> >>
> >> Luke.
> > Do you still have this? Or could you explain how you created the toolchain?
> > Guillermo
> As a test, I updated my ndk and tried to compile both gcc 13 and 12,
> both failed. 13 with Ghost aspects and 12 with missing headers.
>
> They've changed the structure of the sysroot and I don't know enough
> about the android ndk anymore.
Ok, thanks for that. I guess It will be more productive and future-proof to explore the LLVM option... Any clue about that? I understand a bit the logic of LLVM, but putting it into practice probably won't be ease.
On 20/06/2023 14:31, Guillermo Hazebrouck wrote:
> El viernes, 24 de enero de 2014 a la(s) 00:48:07 UTC+1, Lucretia escribió:
>> I built arm and mipsel Android GNAT using the svn/git 4.9.0 branch of GCC.I had to add in mips, but it built. Not done anything with it yet.
>>
>> Luke.
> Do you still have this? Or could you explain how you created the toolchain?
> Guillermo
As a test, I updated my ndk and tried to compile both gcc 13 and 12,
both failed. 13 with Ghost aspects and 12 with missing headers.
They've changed the structure of the sysroot and I don't know enough
about the android ndk anymore.
On 20/06/2023 20:17, Simon Wright wrote:
> "Luke A. Guest" <laguest@archeia.com> writes:
>
>> As for ios, maybe Simon can help here, I never really got around to
>> building it for ios, only android.
>
> No, sorry
Might be better to use gnat-llvm for ios, maybe even android.
On 20/06/2023 20:17, Simon Wright wrote:
> "Luke A. Guest" <laguest@archeia.com> writes:
>
>> As for ios, maybe Simon can help here, I never really got around to
>> building it for ios, only android.
>
> No, sorry
:/
"Luke A. Guest" <laguest@archeia.com> writes:
> As for ios, maybe Simon can help here, I never really got around to
> building it for ios, only android.
No, sorry
Ok, just found a cross compiler on my machine, based on GCC 11. $ ~/opt/android-gnat/bin/x86_64-linux-android-gcc -v Using built-in specs. COLLECT_GCC=/home/laguest/opt/android-gnat/bin/x86_64-linux-android-gcc COLLECT_LTO_WRAPPER=/home/laguest/opt/android-gnat/libexec/gcc/x86_64-linux-android/11.0.0/lto-wrapper Target: x86_64-linux-android Configured with: /home/laguest/src/mine/free-ada/tmp/android/../gcc/configure --target=x86_64-linux-android --prefix=/home/laguest/opt/android-gnat --enable-languages=c,c++,ada --enable-multilib --enable-threads=posix --disable-nls --enable-libgomp --disable-shared --disable-tls --disable-tls --disable-libitm --disable-libstdc__-v3 --disable-sjlj-exceptions --with-sysroot=/home/laguest/src/mine/free-ada/tmp/android/sysroot/android-x86_64 --disable-libssp --with-arch=x86-64 --with-tune=intel --with-fpmath=sse --with-multilib-list=m32,m64 --enable-bionic-libs --disable-bootstrap --enable-plugins --disable-libcilkrts --disable-libsanitizer --enable-gold --enable-threads --enable-eh-frame-hdr-for-static --enable-libatomic-ifuncs=no --enable-initfini-array --enable-gnu-indirect-function --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 11.0.0 20200816 (experimental) (GCC)
There are some pointers here for Android: https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/+/refs/tags/android-cts-6.0_r2/SOURCES --target=aarch64-linux-android and here: https://wiki.gentoo.org/wiki/Android/SharkBait/Building_a_toolchain_for_aarch64-linux-android
On 20/06/2023 14:31, Guillermo Hazebrouck wrote:
> El viernes, 24 de enero de 2014 a la(s) 00:48:07 UTC+1, Lucretia escribió:
>> I built arm and mipsel Android GNAT using the svn/git 4.9.0 branch of GCC.I had to add in mips, but it built. Not done anything with it yet.
>>
>> Luke.
> Do you still have this? Or could you explain how you created the toolchain?
> Guillermo
Not exactly and you'd really need one of the older gcc android ndk's to
get the exact options they were using then and anything else extra they
added. Also they were 32-bit, it's all aarch now.
for android, --target=android-aarch64? or similar. You'd need to specify
the libc as bionic too and I cannot remember how to do it.
As for ios, maybe Simon can help here, I never really got around to
building it for ios, only android.
Would be worth posting it here so it's documented.
El viernes, 24 de enero de 2014 a la(s) 00:48:07 UTC+1, Lucretia escribió:
> I built arm and mipsel Android GNAT using the svn/git 4.9.0 branch of GCC.I had to add in mips, but it built. Not done anything with it yet.
>
> Luke.
Do you still have this? Or could you explain how you created the toolchain?
Guillermo
On 2023-06-17 19:50, Bill Findlay wrote:
>
> I get, in macOS, with:
>
>> gcc -c -gnatl12 b_strings_prob.ads
>
> and the same with with:
>
>> gnatmake -gnatl2022 b_strings_prob.ads
>
>> 13 lines: No errors
>
> Bug in GNAT 13??
Right. This was introduced in GNAT 13. I use the -gnat12 switch, but the error
occurs regardless.
The only thing I can see in the ARM-12 (and still in the ARM) that might apply
is 7.4(6/3): "If the deferred constant declaration includes a subtype_indication
S that defines a constrained subtype, then the constraint defined by the
subtype_indication in the full declaration shall match the constraint defined by
S statically.[ On the other hand, if the subtype of the deferred constant is
unconstrained, then the full declaration is still allowed to impose a
constraint. The constant itself will be constrained, like all constants;]"
This might apply if the subtype in the deferred declaration, which uses the
default discriminant, is considered constrained, since the discriminant applied
from the value supplied for the full declaration is different from the default.
I'm not sure. This wording (without the brackets) has been in the ARM since 1995.
--
Jeff Carter
"I was in love with a beautiful blonde once, dear.
She drove me to drink. That's the one thing I'm
indebted to her for."
Never Give a Sucker an Even Break
109
On 17 Jun 2023, Jeffrey R.Carter wrote (in article <u6jtue$16d9e$1@dont-email.me>): > On 2023-06-17 09:28, Randy Brukardt wrote: > > Regarding your second problem, refer to AI22-0041-1. > > > > Essentially, there are problems if predicates are involved. We changed the > > rule to require static compatibility (as a Binding Interpretation). I don't > > have the energy to look up what "static compatibility" requires in this case > > (enjoy figuring out 4.9.1). In some cases, it requires static matching, in > > others, it has weaker requirements. > > There are no predicates involved. One can cut it down to just the type and > constant: I get, in macOS, with: > gcc -c -gnatl12 b_strings_prob.ads and the same with with: > gnatmake -gnatl2022 b_strings_prob.ads > GNAT 12.2.0 > Copyright 1992-2022, Free Software Foundation, Inc. > Compiling: b_strings_prob.ads > Source file time stamp: 2023-06-17 17:38:32 > Compiled at: 2023-06-17 18:38:38 > 1. package B_Strings_Prob is > 2. type B_String (Max_Length : Positive := 1_000) is taggedlimited private; > 3. > 4. Null_B_String : constant B_String; -- A string of zero characters > 5. private -- B_Strings_Prob > 6. type B_String (Max_Length : Positive := 1_000) is tagged limited record > 7. Len : Natural := 0; > 8. Value : String (1 .. Max_Length) := (1 .. Max_Length => ' '); > 9. end record; > 10. > 11. Null_B_String : constant B_String := (Max_Length => 1, others => <>); > 12. end B_Strings_Prob; > 13. > 13 lines: No errors Bug in GNAT 13?? -- Bill Findlay
On 2023-06-17 09:28, Randy Brukardt wrote: > Regarding your second problem, refer to AI22-0041-1. > > Essentially, there are problems if predicates are involved. We changed the > rule to require static compatibility (as a Binding Interpretation). I don't > have the energy to look up what "static compatibility" requires in this case > (enjoy figuring out 4.9.1). In some cases, it requires static matching, in > others, it has weaker requirements. There are no predicates involved. One can cut it down to just the type and constant: package B_Strings_Prob is type B_String (Max_Length : Positive := 1_000) is tagged limited private; Null_B_String : constant B_String; -- A string of zero characters private -- B_Strings_Prob type B_String (Max_Length : Positive := 1_000) is tagged limited record Len : Natural := 0; Value : String (1 .. Max_Length) := (1 .. Max_Length => ' '); end record; Null_B_String : constant B_String := (Max_Length => 1, others => <>); end B_Strings_Prob; and still get the error: $ gnatmake -gnatc b_strings_prob.ads x86_64-linux-gnu-gcc-13 -c -gnatc b_strings_prob.ads b_strings_prob.ads:12:04: error: subtype does not statically match deferred declaration at line 5 gnatmake: "b_strings_prob.ads" compilation error I don't see any mention of AI22-0041-1 in ARM 7.4. > I don't have the time or energy tonight to look into your other problem. > (I'm waiting for a backup to finish, or I would have already gone home -- > since I only got back from Lisbon last night, I'm not equipped for my usual > late night work...) I'm surprised you're this functional already. -- Jeff Carter "I was in love with a beautiful blonde once, dear. She drove me to drink. That's the one thing I'm indebted to her for." Never Give a Sucker an Even Break 109
Actually, paragraph numbers weren't allowed back in the Ada 83/Ada 95 days.
So the original ISO versions didn't have them. You can use them in ISO
documents now (I don't know when this changed), but you have to get a
special waiver to do so - for *every* individual standard that you want to
have them (that's a recent change, for the worse). And if we added them to
the ISO version (after getting the appropriate waiver -- which I didn't know
about for this last round of standardization), they'd be different than the
ones in the RM (because they wouldn't allow versioning or inserted numbers).
That doesn't seem helpful to me, YMMV.
ISO no longer lets us be compatible with the clause numbering of previous
versions -- ALL standards have to follow their numbering for initial stuff.
They've also changed from requiring not using Annexes I and O (since they're
easily confused with chapters (nope, now sections (nope, now clauses)) -- to
requiring having Annexes I and O.
Bob Duff explained it best: The people maintaining the "standards for
standards" have made no attempt to keep upward compatibilty in their work
(unlike us Ada people). Every standard in existence has to be changed
substantially with each new edition in order to meet the ever-changing
requirements. It's hard to believe that these people don't understand (or
don't care) that these standards are used for a very long time.
Randy Brukardt, Project Editor, ISO/IEC 8652
"Keith Thompson" <Keith.S.Thompson+u@gmail.com> wrote in message
news:87zg51hlm6.fsf@nosuchdomain.example.com...
> dirk@orka.cs.kuleuven.be. (Dirk Craeynest) writes:
> [...]
>> Yes, the introductory chapters in the ISO document are slightly
>> different from those in the RM on ada-auth.org, and there's no Annex on
>> "Obsolescent Features" nor a "Glossary" (that was removed in draft 35
>> anyway). All this is due to specific requirements that ISO has for its
>> standards. There are more differences, such as the ISO document not
>> having any paragraph numbers as those are not allowed in ISO standards.
> [...]
>
> Is disallowing paragraph numbers a recent change? I have a copy of the
> 2011 ISO C standard, ISO/IEC 9899:2011 (E), and it definitely has
> paragraph numbers. (Which are extremely useful, BTW; it seems silly for
> ISO to disallow them.)
>
> --
> Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
> Will write code for food.
> void Void(void) { Void(); } /* The recursive call of the void */
Regarding your second problem, refer to AI22-0041-1.
Essentially, there are problems if predicates are involved. We changed the
rule to require static compatibility (as a Binding Interpretation). I don't
have the energy to look up what "static compatibility" requires in this case
(enjoy figuring out 4.9.1). In some cases, it requires static matching, in
others, it has weaker requirements.
It's possible that GNAT did something too strong when fixing this problem,
as well.
I don't have the time or energy tonight to look into your other problem.
(I'm waiting for a backup to finish, or I would have already gone home --
since I only got back from Lisbon last night, I'm not equipped for my usual
late night work...)
Randy.
"Jeffrey R.Carter" <spam.jrcarter.not@spam.acm.org.not> wrote in message
news:u558m9$1ub3o$1@dont-email.me...
> Here are a couple of things that recent versions of GNAT reject, and I
> suspect that these are GNAT errors, but would appreciate input from
> language lawyers to be sure. If they're not GNAT errors, then they seem
> like things that make Ada less easy to use than I'd like.
>
> The first is gcc bug 108157
> (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108157). GNAT.Sockets has
>
> package GNAT.Sockets is
> ...
> type Selector_Type is limited private;
> ...
> procedure Connect_Socket
> (Socket : Socket_Type;
> Server : Sock_Addr_Type;
> Timeout : Selector_Duration;
> Selector : access Selector_Type := null;
> Status : out Selector_Status);
> -- Connect Socket to the given Server address using Connect_Socket,
> waiting
> -- no longer than the given timeout duration. Status is set to
> indicate
> -- whether the operation completed successfully, timed out, or was
> aborted.
> -- If Selector is not null, the designated selector is used to wait
> for the
> -- socket to become available, else a private selector object is
> created
> -- by this procedure and destroyed before it returns. If Timeout is
> 0.0,
> -- no attempt is made to detect whether the connection has succeeded;
> it
> -- is up to the user to determine this using Check_Selector later on.
> ...
> private
> ...
> type Selector_Type (Is_Null : Boolean := False) is limited record
> case Is_Null is
> when True =>
> null;
>
> when False =>
> R_Sig_Socket : Socket_Type := No_Socket;
> W_Sig_Socket : Socket_Type := No_Socket;
> -- Signalling sockets used to abort a select operation
> end case;
> end record;
> ...
> end GNAT.Sockets;
>
> Kazakov's GNAT.Sockets.Server had (since modified to work with recent
> versions of GNAT)
>
> package GNAT.Sockets.Server is
> ...
> type Connections_Server is tagged limited private;
> ...
> private
> ...
> procedure Do_Connect
> (Listener : in out Connections_Server'Class;
> Client : in out Connection_Ptr);
> ...
> type Connections_Server is tagged limited record
> -- limited because Selector_Type is limited
> Selector : aliased Selector_Type;
> end record;
> ...
> end GNAT.Sockets.Server;
>
> and
>
> package body GNAT.Sockets.Server is
> ...
> procedure Do_Connect
> (Listener : in out Connections_Server'Class;
> Client : in out Connection_Ptr)
> is
> Status : Selector_Status;
> begin
> Connect_Socket
> (Socket => Client.Socket,
> Server => Client.Client_Address,
> Timeout => 0.0,
> Selector => Listener.Selector'Unchecked_Access,
> Status => Status);
> end Do_Connect;
> ...
> end GNAT.Sockets.Server;
>
> Beginning with GNAT 12, the parameter association
>
> Selector => Listener.Selector'Unchecked_Access,
>
> gives the error
>
> object subtype must statically match designated subtype
>
> The FSF GNAT maintainers have decided not to change this, citing
>
> -- Ada 2005 (AI-363): Require static matching when designated
> -- type has discriminants and a constrained partial view, since
> -- in general objects of such types are mutable, so we can't
> -- allow the access value to designate a constrained object
> -- (because access values must be assumed to designate mutable
> -- objects when designated type does not impose a constraint).
>
> I think that those who use anonymous access types get what they deserve,
> but had the parameter been mode "in out", there would be no problem. I
> think that access parameters should work the same as "in out" parameters
> as much as possible.
>
> So, GNAT or Ada problem, or is this a reasonable restriction?
>
> The other instance is in PragmARC.B_Strings
> (https://github.com/jrcarter/PragmARC):
>
> package PragmARC.B_Strings is
> type B_String (Max_Length : Positive := 1024) is tagged limited
> private;
> -- Default initial value is Null_B_String
>
> Null_B_String : constant B_String; -- A string of zero characters
> ...
> private -- PragmARC.B_Strings
> type B_String (Max_Length : Positive := 1024) is tagged limited record
> Len : Natural := 0;
> Value : String (1 .. Max_Length) := (1 .. Max_Length => ' ');
> end record;
>
> Null_B_String : constant B_String := (Max_Length => 1, others => <>);
> end PragmARC.B_Strings;
>
> Beginning with GNAT 13, an error on the full declaration of the constant
> says that its subtype does not statically match that of the deferred
> declaration.
> A workaround is to explicitly declare the discriminant value on both
> declarations. Probably making the full declaration be (others => <>) would
> also work.
>
> I don't see this in ARM 7.4; only constants of an anonymous access type
> have to statically match. So this is probably a compiler error, but I
> thought I would see what the experts think.
>
> --
> Jeff Carter
> "Ada is a management tool. It selects for software
> engineers and encourages the hackers to quit."
> Robert C. Leif
> 204
"Gautier write-only address" <gautier_niouzes@hotmail.com> wrote in message news:9a893d03-ccf9-46cb-b7f0-1e46263cf8b0n@googlegroups.com... > Something thougher is a couple of intrinsic imports (sync_add_and_fetch, > sync_sub_and_fetch): > function sync_add_and_fetch > (Ref : access Interfaces.Unsigned_32; > Add : Interfaces.Unsigned_32) > return Interfaces.Unsigned_32 > with > Import, > Convention => Intrinsic, > External_Name => "__sync_add_and_fetch_4"; > >which seems to be specific to GCC (and actually, not even all versions of >GCC...) This looks like an atomic operation. A portable Ada definition of such operations is found in C.6.1-C.6.4 of Ada 2022. Probably those could be used to replace the operation (of course, that would limit one to compilers supporting that part of Ada 2022; dunno if anyone is doing that yet). Randy.
Jesse, what the fuck are you talking about? -- Posted on Rocksolid Light
Egil H H <ehh.public@gmail.com> writes:
> On Wednesday, June 14, 2023 at 3:13:36 PM UTC+1, Dirk Craeynest wrote:
>
>> But the bulk of the ToC is identical, apart from those differences
>> required by ISO. Most importantly: the described language in both
>> documents is identical.
>>
>
> The clause numbering is not the same, as clause 1 has been split into 4
> clauses in the ISO version, so clause `2 Lexical Elements` in the
> Draft corresponds
> to `5 Lexical Elements` in the ISO version
>
> And (at least) one bug in the ISO ToC,
> `7.3.4 Delta Aggregates` and `7.3.5 Container Aggregates`
> are collapsed beneath `7.3.3. Array Aggregates`,
> even though the subclause level is the same.
From my point of view, never mind the bug, this makes the ISO document a
white elephant.
The stability of the clause numbering, and the hyperlinking, make the RM
the valuable document that it is.
dirk@orka.cs.kuleuven.be. (Dirk Craeynest) writes:
[...]
> Yes, the introductory chapters in the ISO document are slightly
> different from those in the RM on ada-auth.org, and there's no Annex on
> "Obsolescent Features" nor a "Glossary" (that was removed in draft 35
> anyway). All this is due to specific requirements that ISO has for its
> standards. There are more differences, such as the ISO document not
> having any paragraph numbers as those are not allowed in ISO standards.
[...]
Is disallowing paragraph numbers a recent change? I have a copy of the
2011 ISO C standard, ISO/IEC 9899:2011 (E), and it definitely has
paragraph numbers. (Which are extremely useful, BTW; it seems silly for
ISO to disallow them.)
--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */
Egil H H schrieb am Mittwoch, 14. Juni 2023 um 18:11:07 UTC+2:
> On Wednesday, June 14, 2023 at 3:13:36 PM UTC+1, Dirk Craeynest wrote:
> And (at least) one bug in the ISO ToC,
> `7.3.4 Delta Aggregates` and `7.3.5 Container Aggregates`
> are collapsed beneath `7.3.3. Array Aggregates`,
> even though the subclause level is the same.
Not only this. The whole of 7.4 to 7.10 is collaped under 7.3.3.
Dirk Craeynest schrieb am Mittwoch, 14. Juni 2023 um 16:13:36 UTC+2: > AdaMagica <christ-u...@t-online.de> wrote: > >This ist still Draft 35. The final version is not yet available. > Note that the page at the above URL mentions: > > "This is draft 35. This draft contains all ARG-approved AI12s. This > is the draft that has been submitted to complete the standardization > process." > > So draft 35 *is* what was submitted to ISO. Yes; I know... > That message claimed about the ISO document: "The ToC is very different > from Draft 35." Funny, when I first opened the preview, the complete table of contents with page numbers could be read. The ISO document had far less pages then Draft 35 (951 pages). I wondered how this could be... Now the ToC is without page numbers, so I cannot compare. If you compare the ISO ToC and the Draft 35 one, you'll see that clause and subclause numbers differ. So old references like RM 3.5 will lead astray. --- ISO locuta, causa finita. --- > While draft 35 is what was submitted to ISO, the documents indeed are > not identical. Though I would not say the ToC's are "very different". > > Yes, the introductory chapters in the ISO document are slightly > different from those in the RM on ada-auth.org, and there's no Annex on > "Obsolescent Features" nor a "Glossary" (that was removed in draft 35 > anyway). All this is due to specific requirements that ISO has for its > standards. There are more differences, such as the ISO document not > having any paragraph numbers as those are not allowed in ISO standards. > > But the bulk of the ToC is identical, apart from those differences > required by ISO. Most importantly: the described language in both > documents is identical.
On Wednesday, June 14, 2023 at 3:13:36 PM UTC+1, Dirk Craeynest wrote:
> But the bulk of the ToC is identical, apart from those differences
> required by ISO. Most importantly: the described language in both
> documents is identical.
>
The clause numbering is not the same, as clause 1 has been split into 4
clauses in the ISO version, so clause `2 Lexical Elements` in the Draft corresponds
to `5 Lexical Elements` in the ISO version
And (at least) one bug in the ISO ToC,
`7.3.4 Delta Aggregates` and `7.3.5 Container Aggregates`
are collapsed beneath `7.3.3. Array Aggregates`,
even though the subclause level is the same.
--
~egilhh
AdaMagica <christ-usch.grein@t-online.de> wrote: >> ... >> The Ada 2022 LRM is available online: >> www.ada-auth.org/standards/ada22.html. > >This ist still Draft 35. The final version is not yet available. Note that the page at the above URL mentions: "This is draft 35. This draft contains all ARG-approved AI12s. This is the draft that has been submitted to complete the standardization process." So draft 35 *is* what was submitted to ISO. Randy, the RM editor, is aware that this and a few other web pages still have to be updated now ISO published the new RM, and he assured me after the WG9 meeting yesterday that this is on his "to do list". >See also https://groups.google.com/g/comp.lang.ada/c/P26SS3L7kA0 - Ada 23 at Last! That message claimed about the ISO document: "The ToC is very different from Draft 35." While draft 35 is what was submitted to ISO, the documents indeed are not identical. Though I would not say the ToC's are "very different". Yes, the introductory chapters in the ISO document are slightly different from those in the RM on ada-auth.org, and there's no Annex on "Obsolescent Features" nor a "Glossary" (that was removed in draft 35 anyway). All this is due to specific requirements that ISO has for its standards. There are more differences, such as the ISO document not having any paragraph numbers as those are not allowed in ISO standards. But the bulk of the ToC is identical, apart from those differences required by ISO. Most importantly: the described language in both documents is identical. HTH Dirk Dirk.Craeynest@cs.kuleuven.be (for Ada-Belgium/Ada-Europe/SIGAda/WG9) * 27th Ada-Europe Int. Conf. Reliable Software Technologies (AEiC 2023) * June 13-16, 2023, Lisbon, Portugal, www.ada-europe.org/conference2023
> Ada 2022 Language Reference Manual to be Published by Springer > ... > The Ada 2022 LRM is available online: > www.ada-auth.org/standards/ada22.html. This ist still Draft 35. The final version is not yet available. See also https://groups.google.com/g/comp.lang.ada/c/P26SS3L7kA0 - Ada 23 at Last!
----------------------------------------------------------------------- FOR IMMEDIATE RELEASE Ada 2022 Language Reference Manual to be Published by Springer ----------------------------------------------------------------------- Lisbon, Portugal, June 14, 2023 - Ada-Europe today announced, at its 27th International Conference on Reliable Software Technologies (AEiC 2023), that the Ada 2022 Language Reference Manual (LRM) will be published by Springer in its LNCS series later this year. Ada 2022 is the latest edition of the Ada programming language standard, technically denominated ISO/IEC 8652:2023, which was formally approved and officially published by ISO, the Geneva-based International Organization for Standardization, on May 2, 2023. The Ada 2022 LRM is available online: www.ada-auth.org/standards/ada22.html. An overview of Ada 2022 is at: www.ada-auth.org/standards/overview22.html. To mark this official milestone, and in continuation of its established practice, Ada-Europe undertook to support the production of the new LRM as a dedicated issue of the Springer-published LNCS series. About Ada-Europe Ada-Europe is the international non-profit organization that promotes the knowledge and use of the Ada programming language in academia, research and industry. Its flagship event is the annual International Conference on Reliable Software Technologies, a high-quality technical and scientific event that has been successfully running in the current format for the last 27 years. Ada-Europe has member organizations in Belgium, Denmark, France, Germany, Spain, and Switzerland, as well as individual members in many other countries. For information about Ada-Europe, its charter, activities and sponsors, please visit: www.ada-europe.org. Ada-Europe is headquartered in Brussels, Belgium. A PDF version of this press release is available at www.ada-europe.org. Organization Contacts Ada-Europe Tullio Vardanega, Ada-Europe President president@ada-europe.org Press Contacts Ada-Europe Dirk Craeynest, Ada-Europe Vice-president c/o KU Leuven, Department of Computer Science dirk.craeynest@cs.kuleuven.be ----------------------------------------------------------------------- (VAda2022.1)
Good to learn that there is a searchable name "two-language problem" for that issue. Another, not-well-known, solution, is Ada (with HAC on the prototyping side, and GNAT or other full-Ada systems on the production side)...
Probably something wrong with your Python installation. I've tried in GNAT Studio console: >>> import encodings >>> print(encodings.__file__) /tmp/gs/share/gnatstudio/python/lib/python3.9/encodings/__init__.py While if I run system packaged Python in my Ubuntu: $ python3 >>> import encodings >>> print(encodings.__file__) /usr/lib/python3.10/encodings/__init__.py $ dpkg-query -S /usr/lib/python3.10/encodings/__init__.py libpython3.10-minimal:amd64: /usr/lib/python3.10/encodings/__init__.py So, it's part of libpython3.10-minimal Best regards,
LEA is now available on Alire (https://alire.ada.dev/) ! alr index --update-all alr get lea cd lea <-- here you press the Tab key to complete alr build lea
[-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain, Size: 5877 bytes --] ----------------------------------------------------------------------- FINAL Call for Participation *** UPDATED Program Summary *** 27th Ada-Europe International Conference on Reliable Software Technologies (AEiC 2023) 13-16 June 2023, Lisbon, Portugal www.ada-europe.org/conference2023 Organized by Ada-Europe in cooperation with ACM SIGAda, SIGBED, SIGPLAN, the Ada Resource Association (ARA), and the University of Lisbon #AEiC2023 #AdaEurope #AdaProgramming *** Final Program available on the conference web site *** *** Add tutorials and/or a workshop to your conference registration *** www.ada-europe.org/conference2023/tutorials.html *** Welcome Event on Tuesday evening *** ----------------------------------------------------------------------- Press release: 27th Ada-Europe Int'l Conference on Reliable Software Technologies International experts meet in Lisbon Lisbon, Portugal (9 June 2023) - Ada-Europe together with the University of Lisbon organizes from 13 to 16 June 2023 the 27th Ada-Europe International Conference on Reliable Software Technologies (AEiC 2023), in cooperation with the Ada Resource Association (ARA), and with ACM's Special Interest Groups on Ada (SIGAda), on Embedded Systems (SIGBED) and on Programming Languages (SIGPLAN). The Ada-Europe series of conferences is an established international forum for providers, practitioners and researchers in reliable software technologies. These events highlight the increased relevance of Ada in general and in safety- and security-critical systems in particular, and provide a unique opportunity for interaction and collaboration between academics and industrial practitioners. This year's conference offers 4 tutorials, a keynote and a panel discussion, a technical program of 6 sessions with peer-reviewed papers, industrial and work-in-progress presentations, posters, social events, and 2 workshops. Presentations are given by authors from 15 countries. Six tutorials are scheduled on Tuesday, targeting different audiences: - "The HAC Ada Compiler", - "Controlling I/O Devices with Ada and the Linux Simple I/O Library", - "Everything you Always Wanted to Know about Characters and Strings", - "Introduction to the Development of Safety Critical Software", - "Rust Fundamentals", - "Concurrency and Parallelism in Rust". On Wednesday and Thursday, the networking area features WiP posters, as well as an Ada-Europe booth. Eminent speakers have been invited on each of the core conference days: - on Wednesday, a keynote talk by Alcides Fonseca, from LASIGE, University of Lisbon Faculty of Sciences, who will talk about "Applications of liquid types for more reliable software"; - on Thursday, a panel on "Promises and Challenges of AI-enabled Software Development Tools for Safety-Critical Applications" with Douglas Schmidt (Vanderbilt University, USA), Jochen Quante (Robert Bosch GmbH, Germany), and Jon Pérez Cerrolaza (IKERLAN, Spain). The technical program on Wednesday and Thursday includes 6 journal-track refereed technical papers, 7 industrial, and 15 work-in-progress presentations, in sessions on: Verification and Validation 1, Advanced Systems, Reliability and Performance, Verification and Validation 2, Reliable Programming, Real-Time Systems. On Friday the conference hosts for the 8th year the workshop on "Challenges and New Approaches for Dependable and Cyber-Physical Systems Engineering" (DeCPS 2023), as well as the workshop "AADL by its Practitioners (ADEPT)". Peer-reviewed papers have been submitted to a special issue of the Journal of Systems Architecture and are heading towards final acceptance as open-access publications. Industrial and work-in-progress presentations, together with tutorial abstracts, and workshop papers, will appear in issues of the Ada User Journal, the quarterly magazine of Ada-Europe. The social program includes on Tuesday evening a Welcome Reception in the gardens of the National Museum of Science & Natural History, and on Wednesday evening the Conference Banquet in the "Casa do Alentejo" restaurant, an old palace in downtown Lisbon with several exquisite rooms, that served as a casino in the 20th century. The Best Presentation Award will be offered during the Closing session. The full program is available on the conference web site. Online registration is still possible. ------- Latest updates: The 16-page "Final Program" is available at www.ada-europe.org/conference2023/media/AEiC_2023_Final_Program.pdf Check out the tutorials in the PDF program, or in the schedule at www.ada-europe.org/conference2023/tutorials.html. Registration is done on-line. For all details, go to www.ada-europe.org/conference2023/registration.html. A printed Conference Booklet with abstracts of all technical papers and industrial presentations will be included in every conference handout, and will be available on the conference web site. AEiC 2023 is sponsored by Ada-Europe (www.ada-europe.org), AdaCore (www.adacore.com), and GMV (www.gmv.com). Help promote the conference by advertising it. Recommended Twitter hashtags: #AEiC2023 #AdaEurope #AdaProgramming. ----------------------------------------------------------------------- Our apologies if you receive multiple copies of this announcement. Please circulate widely. Dirk Craeynest, AEiC 2023 Publicity Chair Dirk.Craeynest@cs.kuleuven.be * 27th Ada-Europe Int. Conf. Reliable Software Technologies (AEiC 2023) * June 13-16, 2023, Lisbon, Portugal, www.ada-europe.org/conference2023 (V7.1)
On Thursday, June 8, 2023 at 1:00:55 AM UTC-7, Dmitry A. Kazakov wrote: > I think comparison is misplaced. Julia is an interpreted language, very > slow, on par with Python. It has memory mapped arrays like Ada does, but > lacks Python's precompiled modules. The syntax is wonderfully arbitrary > and unpredictable... [I guess this is OT.] Julia is a hot mess. Rather than being interpreted, it uses a just-in-time compiler, so they claim they have the solution to the "two-language problem" of prototyping in a slow language such as Python then re-writing in a compiled language for speed. There are problems. Julia has a bad habit of forgetting that it compiled a program before (no saved binary between sessions) so it has to re-compile it each time. (I think there are work-arounds but not intended for mere mortals.) Julia folks seem to have invented the phrase "time to first plot" because much of the Julia ecosystem is written in Julia so it has to go off and compile the plotters before you can make the first plot, or something like that. However, using Julia in Visual Studio Code where there is a very nice notebook Jupyter environment plus a very clever hybrid of a REPL and standard editor, is quite delightful. There is a set of officially published instructions for getting maximum speed from Julia https://docs.julialang.org/en/v1/manual/performance-tips; when printed as as PDF, it spans 36 pages and uses terminology and concepts that only an expert will know. People love Julia for its multiple-dispatch feature whereby it automatically generates a different version of a subroutine for every combination of argument and result that it can discover. (This behavior can be overridden by using ----- optional typing!) If you think dynamic typing is 180 degrees from strong typing, I would suggest that it is now only 90 degrees from strong typing, with Julia's brand new opportunities for accidentally calling a subroutine that you didn't even know existed now occupying the 180 degree position.
On 08/06/2023 04:55, Nasser M. Abbasi wrote:
> Some folks in this thread
>
> https://discourse.julialang.org/t/comparison-of-rust-to-julia-for-scientific-computing/78508
>
> "I’m not an expert, but my feeling is that Rust is a “safer” language,
> which to me means it must be slower."
What these idiots ^ never do is define "slow," slow compared to WHAT?
They also don't seem to realise we basically use supercomputers now,
these things are way more powerful than the 8-bit/16-bit cpu's of the
70's and 80's. This mentality has come from there where optimisation at
the assembly level to pick the faster (less clock cycles) instructions.
And they always just say "Oh, that's SLOW!" I had the same when I joined
that games company, "we don't use virtuals, because they're SLOW." No,
they might be a tad slower in clock cycles.
These people also don't do safety, they don't do checks most of the time
and just want to make stuff as "fast" as possible without doing anything
to make sure it works correctly.
On 2023-06-08 05:55, Nasser M. Abbasi wrote: > > Some in that thread seem to argue that a safer language > will/could be slower than otherwise. > > Since Ada is known to be one of the safest languages, > do others here feel there is any truth to this? Equivalent programs in compiled, non-GC languages have equivalent execution times. Robert Dewar famously had a set of equivalent Ada and C programs that produced identical machine code when compiled with gcc. So this is false. The problem is getting equivalent programs. If the safe language includes run-time checks, then equivalent checks must be manually added to the unsafe language. Ada.Text_IO is not equivalent to C's I/O facilities. And so on. Once consequence of this is that both programs will be equally correct. What is usually compared is a correct (run-time checks) program in the safe language to an incorrect (no run-time checks) program in the unsafe language. About optimization, Tartan made its living selling highly optimizing C compilers for TI chips, which came with a free C compiler. They also made highly optimizing Ada compilers, which did a better job of optimization than their C compilers. This was documented in C vs Ada: arguing performance religion (https://dl.acm.org/doi/10.1145/216578.216583) which discusses four advantages Ada (83) has over C for optimization. See also Ada Outperforms Assembly: A Case Study (https://www2.seas.gwu.edu/~adagroup/sigada-website/lawlis.html) TI bought Tartan and sold its Ada compilers to DDC-I. -- Jeff Carter "Monsieur Arthur King, who has the brain of a duck, you know." Monty Python & the Holy Grail 09
On 2023-06-08 05:55, Nasser M. Abbasi wrote: > Some folks in this thread > > https://discourse.julialang.org/t/comparison-of-rust-to-julia-for-scientific-computing/78508 > > "I’m not an expert, but my feeling is that Rust is a “safer” language, > which to me means it must be slower." I think comparison is misplaced. Julia is an interpreted language, very slow, on par with Python. It has memory mapped arrays like Ada does, but lacks Python's precompiled modules. The syntax is wonderfully arbitrary and unpredictable... > Some in that thread seem to argue that a safer language > will/could be slower than otherwise. > Since Ada is known to be one of the safest languages, > do others here feel there is any truth to this? > > I thought that by having more type information in the language, > the compile will be able to make more optimizations (because it > know more), and hence the generated code should actually be > faster, not slower with a language that is less safe? > > I am not a compiler expert but what do others here think? If safety is prevention of logical errors (bugs) you and your team and people deploying the software could make, then techniques and processes determine the outcome. The language can only support certain techniques. Of these techniques and processes some may require run-time overhead. When people compare languages, they frequently do programming techniques instead. As it was observed many decades ago: "Besides, the determined Real Programmer can write Fortran programs in any language." And finally, if you determined to use some technique, then lack of language support makes the language less safe. E.g. if you are in some agile programming lager then semantic constraints imposed by Ada would make things only worse. Even Brainf*ck might be the safest language under circumstances... (:-)) -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
On 2023-06-08 6:55, Nasser M. Abbasi wrote:
> Some folks in this thread
>
> https://discourse.julialang.org/t/comparison-of-rust-to-julia-for-scientific-computing/78508
>
> "I’m not an expert, but my feeling is that Rust is a “safer” language,
> which to me means it must be slower."
>
> etc..
>
> Some in that thread seem to argue that a safer language
> will/could be slower than otherwise.
>
> Since Ada is known to be one of the safest languages,
> do others here feel there is any truth to this?
>
> I thought that by having more type information in the language,
> the compile will be able to make more optimizations (because it
> know more), and hence the generated code should actually be
> faster, not slower with a language that is less safe?
>
> I am not a compiler expert but what do others here think?
If a language needs run-time checks to ensure safety, those checks
usually take some time, making for slower execution.
If a language has a type system and compilation-time (legality) rules
such that the compiler can prove that some run-time checks are not
needed, that reduces or eliminates the slow-down. This is the case for Ada.
The effect of type information on optimization is harder (at least for
me) to understand. If the type information lets the compiler assume that
some objects are not aliased, that can help optimization because more
computation can be done in registers alone, without using main memory.
This applies to Ada, but also applies to standard C, for example,
although some people use non-standard C features (compiler options) to
negate this.
However, when comparing the "speed" of two languages and their two
implementations I think that the implementations usually matter more
than the languages.
Some folks in this thread https://discourse.julialang.org/t/comparison-of-rust-to-julia-for-scientific-computing/78508 "I’m not an expert, but my feeling is that Rust is a “safer” language, which to me means it must be slower." etc.. Some in that thread seem to argue that a safer language will/could be slower than otherwise. Since Ada is known to be one of the safest languages, do others here feel there is any truth to this? I thought that by having more type information in the language, the compile will be able to make more optimizations (because it know more), and hence the generated code should actually be faster, not slower with a language that is less safe? I am not a compiler expert but what do others here think? --Nasser
On 2023-06-07 08:45, reinert wrote: > I use Ada and consider to apply current time to label (dynamic) data so one always can access the latest corrections/versions. This could be a source or error if current (real) time is reported wrong. So is it possible automatically to check that Network time is available and correctly reported (using Ada)? Yes, you can query an NTP time server. E.g. see http://www.dmitry-kazakov.de/ada/components.htm#17.17 -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
Hello, This may not be a specific Ada question, but anyway: I use Ada and consider to apply current time to label (dynamic) data so one always can access the latest corrections/versions. This could be a source or error if current (real) time is reported wrong. So is it possible automatically to check that Network time is available and correctly reported (using Ada)? reinert
This may not be a specific Ada question, but anyway: I use Ada and consider to apply current time to label (dynamic) data so one always can access the latest corrections/versions. This could be a source or error if current (real) time is reported wrong. So is it possible automatically to check that Network time is available and correctly reported (using Ada)? reinert
The source code is more than 20K lines :-)
Would be nice with error messages which are easier to understand.
I did return to the version before the latest changes and retyped - now it works and the Ada goddess smiles to me.
I googled "gnat undefined reference" and noticed that others also have encountered mysterious "undefined reference to...". Seems one have to be careful and frequently check when developing programmes above some size limit.
reinert
mandag 5. juni 2023 kl. 11:59:37 UTC+2 skrev Maxim Reznik:
> It's hard to say without the source code. The linker can't find command_processing1__set_wellplate1 symbol used somewhere in kobio0.adb.
On 5/6/23 20:15, Maxim Reznik wrote:
> Great! Waiting for GNAT Studio in Arch Linux :)
>
Heh, I've just this minute finished the build/install of GNAT Studio
for Arch Linux. The build of GS (and all of it's dependencies) went very
well, largely due to using all of the sources provided in the recent GS
sources tarball release. So thank you again for suggesting that.
I still have one problem to solve. When I run GS, i get the
following python error ...
Fatal Python error: init_fs_encoding: failed to get the Python codec of
the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named 'encodings'
A quick google did not yield any promising solutions but I will look
again tomorrow. If anyone can suggest possible reasons/solutions I'd be
very grateful. I know little about that pesky snake and less about how
to treat one constricted by the beast :).
Regards.
Great! Waiting for GNAT Studio in Arch Linux :) Speaking about AppImage. If you want installed version of GNAT Studio (for instance to have an access to the gnatdoc/gnatdoc4), then you can extract AppImage as an old .tag.gz archive and run doinstall: chmod +x ./GNAT_Studio-x86_64.AppImage ./GNAT_Studio-x86_64.AppImage --appimage-extract ./squashfs-root/usr/doinstall Best regards,
It's hard to say without the source code. The linker can't find command_processing1__set_wellplate1 symbol used somewhere in kobio0.adb.
Thanx Jeff, works now. Should be written in the README.md. Christoph
On 2023-06-04 18:10, AdaMagica wrote: > > downloaded QPlt, Ada_GUI, PragmARC, linked OK > 2023-06-04 17:58:46.17 : Requested: Kind: FILE, File: , Query: > 2023-06-04 17:58:46.17 : Reply: Not found > > And browser window says: http://127.0.0.1:8080/ > No file "" found > > What am I missing? Do I have to put QPlt in the same directory as Ada_GUI? As the Readme for Ada GUI says, "The Test directory contains boot.html, boot.js, and jquery.min.js. These files must be available to every Ada-GUI program." (https://github.com/jrcarter/Ada_GUI/blob/master/README.md) Typically you put a copy of these in any working directory from which you run an Ada-GUI program. I guess I thought that anyone not already familiar with Ada GUI would install and test it first before using it to build Qplt, and in the process become aware of this. Silly me. -- Jeff Carter "It is the German who is so uncourteous to his verbs." A Scandal in Bohemia 122
Hi Jeffrey, downloaded QPlt, Ada_GUI, PragmARC, linked OK (with many warnings "-gnatyOr", -- overriding indicators, casing as in declaration). Tried to run according to your README.md. Result for any attempt the same: C:\Path...\Ada-Libraries\Qplot\Orig>qplt np qplt_sine.txt Ada GUI :1.0 Application root :C:\Users\Grein\Documents\Christoph\Ada-Libraries\Qplot\Orig\ Executable at :C:\Users\Grein\Documents\Christoph\Ada-Libraries\Qplot\Orig\ HTML root :C:\Users\Grein\Documents\Christoph\Ada-Libraries\Qplot\Orig\ Upload directory :C:\Users\Grein\Documents\Christoph\Ada-Libraries\Qplot\Orig\ Templates root :C:\Users\Grein\Documents\Christoph\Ada-Libraries\Qplot\Orig\ /js at :C:\Users\Grein\Documents\Christoph\Ada-Libraries\Qplot\Orig\ /css at :C:\Users\Grein\Documents\Christoph\Ada-Libraries\Qplot\Orig\ /img at :C:\Users\Grein\Documents\Christoph\Ada-Libraries\Qplot\Orig\ Boot file :boot.html HTTP listen on :localhost:8080 Singleton application. Press Ctrl-C to close server. 2023-06-04 17:58:45.03 : HTTP Server Started 2023-06-04 17:58:46.17 : Requested: Kind: FILE, File: , Query: 2023-06-04 17:58:46.17 : Reply: Not found And browser window says: http://127.0.0.1:8080/ No file "" found What am I missing? Do I have to put QPlt in the same directory as Ada_GUI? Christoph
On Tuesday, May 30, 2023 at 9:56:17 AM UTC+2, Jeffrey R.Carter wrote:
> I took a quick look. Wouldn't all of Gnatcom need to be replaced?
Good question.
When I compile a project using GWindows, GNAT uses 10 of the 53 GNATCOM packages.
One GNATism is 4x 'Unrestricted_Access in GNATCOM.Types, for accesses such as:
VARIANT_MISSING : aliased constant VARIANT :=
(VT_ERROR, 0, 0, 0, u => (Which => 8, scode => DISP_E_PARAMNOTFOUND));
PVARIANT_MISSING : Pointer_To_VARIANT :=
VARIANT_MISSING'Unrestricted_Access;
that could be either resolved into a standard Ada form or exiled into another package (GWindows doesn't need them).
Something thougher is a couple of intrinsic imports (sync_add_and_fetch, sync_sub_and_fetch):
function sync_add_and_fetch
(Ref : access Interfaces.Unsigned_32;
Add : Interfaces.Unsigned_32)
return Interfaces.Unsigned_32
with
Import,
Convention => Intrinsic,
External_Name => "__sync_add_and_fetch_4";
which seems to be specific to GCC (and actually, not even all versions of GCC...)
Hello, I use gnat/alire under debian (latest version). Now suddenly I get the confusing error message below after "alr build". Anybody who could give me a hint? reinert alr build ⓘ Building kobio5/kobio5.gpr... Link [link] kobio0.adb /home/reinert/.config/alire/cache/dependencies/gnat_native_12.2.1_11f3b811/bin/../lib/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: warning: kobio0.o: requires executable stack (because the .note.GNU-stack section is executable) /home/reinert/.config/alire/cache/dependencies/gnat_native_12.2.1_11f3b811/bin/../lib/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: kobio0.o: in function `kobio0__execute_command1.242': kobio0.adb:(.text+0x351e7): undefined reference to `command_processing1__set_wellplate1' collect2: error: ld returned 1 exit status gprbuild: link of kobio0.adb failed gprbuild: failed command was: /home/reinert/.config/alire/cache/dependencies/gnat_native_12.2.1_11f3b811/bin/gcc kobio0.o b__kobio0.o /home/reinert/kobio5/obj/bzip2.o /home/reinert/kobio5/obj/bzip2-decoding.o /home/reinert/kobio5/obj/split_string.o /home/reinert/kobio5/obj/cpros.o /home/reinert/kobio5/obj/gid-buffering.o /home/reinert/kobio5/obj/gid-color_tables.o /home/reinert/kobio5/obj/gid-decoding_bmp.o /home/reinert/kobio5/obj/gid-decoding_gif.o /home/reinert/kobio5/obj/gid-decoding_jpg.o /home/reinert/kobio5/obj/gid-decoding_png-huffman.o /home/reinert/kobio5/obj/gid-decoding_png.o /home/reinert/kobio5/obj/gid-decoding_pnm.o /home/reinert/kobio5/obj/gid-decoding_tga.o /home/reinert/kobio5/obj/gid-headers.o /home/reinert/kobio5/obj/gid.o /home/reinert/kobio5/obj/gl.o /home/reinert/kobio5/obj/rkutil1.o /home/reinert/kobio5/obj/cell_names0.o /home/reinert/kobio5/obj/cell_names1.o /home/reinert/kobio5/obj/gl-io.o /home/reinert/kobio5/obj/gl-math.o /home/reinert/kobio5/obj/gl-geometry.o /home/reinert/kobio5/obj/gl-frustums.o /home/reinert/kobio5/obj/gl-materials.o /home/reinert/kobio5/obj/gl-simple_text.o /home/reinert/kobio5/obj/glu.o /home/reinert/kobio5/obj/gl-errors.o /home/reinert/kobio5/obj/gl-textures.o /home/reinert/kobio5/obj/gl-skins.o /home/reinert/kobio5/obj/gl-skinned_geometry.o /home/reinert/kobio5/obj/glut.o /home/reinert/kobio5/obj/glut_2d.o /home/reinert/kobio5/obj/lzma.o /home/reinert/kobio5/obj/lzma-decoding.o /home/reinert/kobio5/obj/version1.o /home/reinert/kobio5/obj/file_handling1.o /home/reinert/kobio5/obj/image1.o /home/reinert/kobio5/obj/plot1.o /home/reinert/kobio5/obj/cells.o /home/reinert/kobio5/obj/ctutil1.o /home/reinert/kobio5/obj/scene_objects1.o /home/reinert/kobio5/obj/statistics1.o /home/reinert/kobio5/obj/cells-pt_cell_scenes_p.o /home/reinert/kobio5/obj/cells-pt_cell_scenes_p-tree1_parameters1.o /home/reinert/kobio5/obj/network1.o /home/reinert/kobio5/obj/plot_image.o /home/reinert/kobio5/obj/plot_image-plot_cells1_p.o /home/reinert/kobio5/obj/io.o /home/reinert/kobio5/obj/command_processing1.o /home/reinert/kobio5/obj/segment_image.o /home/reinert/kobio5/obj/zip_streams.o /home/reinert/kobio5/obj/zip-headers.o /home/reinert/kobio5/obj/zip.o /home/reinert/kobio5/obj/zip-crc_crypto.o /home/reinert/kobio5/obj/unzip.o /home/reinert/kobio5/obj/unzip-decompress-huffman.o /home/reinert/kobio5/obj/unzip-decompress.o /home/reinert/kobio5/obj/unzip-streams.o /home/reinert/kobio5/obj/globe_3d-math.o /home/reinert/kobio5/obj/globe_3d-aux.o /home/reinert/kobio5/obj/globe_3d-options.o /home/reinert/kobio5/obj/globe_3d-portals.o /home/reinert/kobio5/obj/globe_3d-textures.o /home/reinert/kobio5/obj/globe_3d.o /home/reinert/kobio5/obj/globe_3d-software_anti_aliasing.o /home/reinert/kobio5/obj/game_control.o /home/reinert/kobio5/obj/actors.o /home/reinert/kobio5/obj/glut-windows.o /home/reinert/kobio5/obj/glut-devices.o -lglut -lGL -lGLU -L/home/reinert/kobio5/obj/ -L/home/reinert/kobio5/obj/ -L/home/reinert/.config/alire/cache/dependencies/gnat_native_12.2.1_11f3b811/lib/gcc/x86_64-pc-linux-gnu/12.2.0/adalib/ -static-libgcc /home/reinert/.config/alire/cache/dependencies/gnat_native_12.2.1_11f3b811/lib/gcc/x86_64-pc-linux-gnu/12.2.0/adalib/libgnarl.a /home/reinert/.config/alire/cache/dependencies/gnat_native_12.2.1_11f3b811/lib/gcc/x86_64-pc-linux-gnu/12.2.0/adalib/libgnat.a -lrt -lpthread -lm -ldl -Wl,-rpath-link,/home/reinert/.config/alire/cache/dependencies/gnat_native_12.2.1_11f3b811/lib/gcc/x86_64-pc-linux-gnu/12.2.0//adalib -Wl,-z,origin,-rpath,$ORIGIN/..//obj:$ORIGIN/../..//.config/alire/cache/dependencies/gnat_native_12.2.1_11f3b811/lib/gcc/x86_64-pc-linux-gnu/12.2.0/adalib -o /home/reinert/kobio5/bin//kobio0 error: Command ["gprbuild", "-s", "-j0", "-p", "-P", "/home/reinert/kobio5/kobio5.gpr"] exited with code 4 error: Compilation failed.
I've been holding of posting this for fear of rotten tomatoes ... but here goes ... "Tis no uncertain adage, That that balmy beggar Babbage, Was to antsy Aunty Ada, No uncertain ennui saviour!" ... just putting on my hazmat suit now, so fire away :).
I have created Qplt (Quick Plot), and Ada-GUI program to quickly produce a plot of a data set, and make it publicly available in hopes that it might prove useful. The program automatically selects axis ranges and tick intervals. The user may select whether points, lines, or both are plotted, and supply a title and axis labels. Qplt is available at https://github.com/jrcarter/Qplt Enjoy. -- Jeff Carter "People called Romanes, they go the house?" Monty Python's Life of Brian 79
Hello all, I'd like to do as the subject line indicates and so make Ada a 1st class citizen on Arch. To do so, gprbuild and xmlada (which currently reside in the Arch User Repository (AUR)) require votes from users. So I'd like to ask anyone using Ada on Arch to vote in order to improve the chances. These are the links ... https://aur.archlinux.org/packages/gprbuild https://aur.archlinux.org/packages/xmlada Regards.
On 1/6/23 19:21, Maxim Reznik wrote: > понедельник, 15 мая 2023 г. в 13:43:31 UTC+3, Rod Kay: > > All sources are in release assets, like gnatstudio-sources-x86_64-linux.tar.gz. It has spawn-24.0w-20230428-162D4-src.tar.gz for example. > Ah, great. I will try re-build with this. >> >> Also, in the new binary, 'Find all references' appears to be broken >> (it finds no references). I guess, the same would apply for the >> refactoring tool. I've been advised to report the issue and will do so >> tomorrow. It might help to know if other people also experience the same >> problem(s), before reporting ? >> > > It looks like your ada_language_server doesn't work. Take a look in GS log files (in ~/.gnatstudio/ folder). > I've just re-tested and 'Find all references' works perfectly. How embarrassing! All i can think of is that I may have had an old gnatstudio version running when I did the GS update and so was still using the old version when I initially tested. Thanks very much Reznik, very helpful. Regards.
Fernando Oleo Blanco <irvise_ml@irvise.xyz> wrote: >P.S: I, Fer, will post this over at the C.L.A and Ada-Lang.io. Feel free >to repost this to Reddit, Gitter/Matrix, Telegram or any other channels! >The more people know about this, the better (I hope). Reposted to all Ada-Belgium members. HTH Dirk Dirk.Craeynest@cs.kuleuven.be (for Ada-Belgium/Ada-Europe/SIGAda/WG9) +-------------/ Home: http://www.cs.kuleuven.be/~dirk/ada-belgium |Ada-Belgium / E-mail: ada-belgium-board@cs.kuleuven.be +-----------/ Maillist: ada-belgium[-info]-request@ls.kuleuven.be * 27th Ada-Europe Int. Conf. Reliable Software Technologies (AEiC 2023) * June 13-16, 2023, Lisbon, Portugal, www.ada-europe.org/conference2023
понедельник, 15 мая 2023 г. в 13:43:31 UTC+3, Rod Kay: > On 15/5/23 07:31, 196...@ wrote: > > And for Linux it's an appimage. Why? I mean? Its...? > > Why not? It's compact. It doesn't require any installation, so it's handy. You can extract content with --appimage-extract and install GS with ./squashfs-root/usr/doinstall as before. > > I just wish they could get it into shape where the build was doable without so much hassle - I've never beenable to manage it. > The build *has* been getting easier. I maintain the Archlinux > gnatStudio package and have nearly got it to build. Currently, I'm > waiting on a new/matching release of the AdaCore spawn project. I could, > I suppose, use the latest commit version but would prefer to use a > formal release. All sources are in release assets, like gnatstudio-sources-x86_64-linux.tar.gz. It has spawn-24.0w-20230428-162D4-src.tar.gz for example. > > Also, in the new binary, 'Find all references' appears to be broken > (it finds no references). I guess, the same would apply for the > refactoring tool. I've been advised to report the issue and will do so > tomorrow. It might help to know if other people also experience the same > problem(s), before reporting ? > It looks like your ada_language_server doesn't work. Take a look in GS log files (in ~/.gnatstudio/ folder). > > > Regards.
The PragmARCs are a library of (mostly) useful Ada reusable components provided as source code under the GMGPL or BSD 3-Clause license at https://github.com/jrcarter/PragmARC. This reminder will be posted about every six months so that newcomers become aware of the PragmARCs. I presume that those who want notification when the PragmARCs are updated have used Github's notification mechanism to receive them, so I no longer post update announcements. Anyone who wants to receive notifications without using Github's mechanism should contact me directly. -- Jeffrey R. Carter, President PragmAda Software Engineering github.com/jrcarter pragmada.x10hosting.com
Le 01/06/2023 à 05:18, Gautier write-only address a écrit : >>> Alire: are you missing a LEA crate? >> Why not but I was thinking compiling/running Alire projects from LEA. > > Good idea! For instance the "Build & Run" command (the green button) would launch "alr run" in that context. > Added to the to-do list. >Plus a terminal window running Alire terminal to manage Alire projects directly from LEA. > Side note: a cool project would be a graphical tool, "Alire Explorer" (good name to be found) with buttons for the key Alire commands, a box displaying the contents of "alr show", ... > Perhaps something to be made with GNOGA. > With a Alire project search feature to list Alire projects on a disk ? >>> ALS: = Ada language server? >> That's it. Auto-completion and mouse-over documentation in LEA. > > Also added to the to-do list. This would be a very cool feature.
> > Alire: are you missing a LEA crate? > Why not but I was thinking compiling/running Alire projects from LEA. Good idea! For instance the "Build & Run" command (the green button) would launch "alr run" in that context. Added to the to-do list. Side note: a cool project would be a graphical tool, "Alire Explorer" (good name to be found) with buttons for the key Alire commands, a box displaying the contents of "alr show", ... Perhaps something to be made with GNOGA. > > ALS: = Ada language server? > That's it. Auto-completion and mouse-over documentation in LEA. Also added to the to-do list.
Old thread, but since some search engines point to here as top hit when searching for "ayacc" and "aflex", it is worth mentioning that the new developments (as of mid 2023) of ayacc and and aflex are located here: https://github.com/Ada-France/ayacc https://github.com/Ada-France/aflex G.
Hi all, this message contains the final time of the meeting, connection details and other info. The (first!) Ada Monthly Meetup will take place this Saturday 3rd of June at 13:00 UTC Time. That corresponds to 15:00 CET (Central European Time: Madrid, Paris, Berlin, Rome...). The meetup will take place over at Jitsi, a conferencing software that runs on any modern browser. The link is https://meet.jit.si/2023AdaMonthlyMeetupJune The room name is "2023AdaMonthlyMeetupJune" and in case it asks for a password, it will be set to "first". I do not want to set up a password, but in case it is needed, it will be the one above without the quotes. The room name is generally not needed as the link should take you directly there, but I want to write it down just in case someone needs it. Talks: No one proposed any topics, but that is fine as **this first meeting will not be recorded.** I will record it for internal testing and to see how it works, but it will not be published. Having no talks will allow us, the community, to discuss any technical issues and comments that may help improve the experience of the monthly meetup. However, I will give a short introduction and share my ideas at the beginning :) Someone could also propose a topic for the next meetup too. If I forgot something, please, point it out so that any issues can get patched out. Best regards, Fer P.S: I, Fer, will post this over at the C.L.A and Ada-Lang.io. Feel free to repost this to Reddit, Gitter/Matrix, Telegram or any other channels! The more people know about this, the better (I hope). P.P.S: this if for C.L.A only. The main thread was named "Ada Monthly Meetup Proposal". However, as this is no longer a proposal, but the actual thing, I am creating a new thread. For more information, please, refer to the aforementioned thread!
Here are a couple of things that recent versions of GNAT reject, and I suspect that these are GNAT errors, but would appreciate input from language lawyers to be sure. If they're not GNAT errors, then they seem like things that make Ada less easy to use than I'd like. The first is gcc bug 108157 (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108157). GNAT.Sockets has package GNAT.Sockets is ... type Selector_Type is limited private; ... procedure Connect_Socket (Socket : Socket_Type; Server : Sock_Addr_Type; Timeout : Selector_Duration; Selector : access Selector_Type := null; Status : out Selector_Status); -- Connect Socket to the given Server address using Connect_Socket, waiting -- no longer than the given timeout duration. Status is set to indicate -- whether the operation completed successfully, timed out, or was aborted. -- If Selector is not null, the designated selector is used to wait for the -- socket to become available, else a private selector object is created -- by this procedure and destroyed before it returns. If Timeout is 0.0, -- no attempt is made to detect whether the connection has succeeded; it -- is up to the user to determine this using Check_Selector later on. ... private ... type Selector_Type (Is_Null : Boolean := False) is limited record case Is_Null is when True => null; when False => R_Sig_Socket : Socket_Type := No_Socket; W_Sig_Socket : Socket_Type := No_Socket; -- Signalling sockets used to abort a select operation end case; end record; ... end GNAT.Sockets; Kazakov's GNAT.Sockets.Server had (since modified to work with recent versions of GNAT) package GNAT.Sockets.Server is ... type Connections_Server is tagged limited private; ... private ... procedure Do_Connect (Listener : in out Connections_Server'Class; Client : in out Connection_Ptr); ... type Connections_Server is tagged limited record -- limited because Selector_Type is limited Selector : aliased Selector_Type; end record; ... end GNAT.Sockets.Server; and package body GNAT.Sockets.Server is ... procedure Do_Connect (Listener : in out Connections_Server'Class; Client : in out Connection_Ptr) is Status : Selector_Status; begin Connect_Socket (Socket => Client.Socket, Server => Client.Client_Address, Timeout => 0.0, Selector => Listener.Selector'Unchecked_Access, Status => Status); end Do_Connect; ... end GNAT.Sockets.Server; Beginning with GNAT 12, the parameter association Selector => Listener.Selector'Unchecked_Access, gives the error object subtype must statically match designated subtype The FSF GNAT maintainers have decided not to change this, citing -- Ada 2005 (AI-363): Require static matching when designated -- type has discriminants and a constrained partial view, since -- in general objects of such types are mutable, so we can't -- allow the access value to designate a constrained object -- (because access values must be assumed to designate mutable -- objects when designated type does not impose a constraint). I think that those who use anonymous access types get what they deserve, but had the parameter been mode "in out", there would be no problem. I think that access parameters should work the same as "in out" parameters as much as possible. So, GNAT or Ada problem, or is this a reasonable restriction? The other instance is in PragmARC.B_Strings (https://github.com/jrcarter/PragmARC): package PragmARC.B_Strings is type B_String (Max_Length : Positive := 1024) is tagged limited private; -- Default initial value is Null_B_String Null_B_String : constant B_String; -- A string of zero characters ... private -- PragmARC.B_Strings type B_String (Max_Length : Positive := 1024) is tagged limited record Len : Natural := 0; Value : String (1 .. Max_Length) := (1 .. Max_Length => ' '); end record; Null_B_String : constant B_String := (Max_Length => 1, others => <>); end PragmARC.B_Strings; Beginning with GNAT 13, an error on the full declaration of the constant says that its subtype does not statically match that of the deferred declaration. A workaround is to explicitly declare the discriminant value on both declarations. Probably making the full declaration be (others => <>) would also work. I don't see this in ARM 7.4; only constants of an anonymous access type have to statically match. So this is probably a compiler error, but I thought I would see what the experts think. -- Jeff Carter "Ada is a management tool. It selects for software engineers and encourages the hackers to quit." Robert C. Leif 204
On 2023-05-30 01:59, Gautier write-only address wrote:
>
> IIRC, there are a few GNAT-only attributes, like Unrestricted_Access, used. No big deal.
> But good point, I could check "purity" with the ObjectAda compiler.
I took a quick look. Wouldn't all of Gnatcom need to be replaced?
--
Jeff Carter
"Ada is a management tool. It selects for software
engineers and encourages the hackers to quit."
Robert C. Leif
204
Le 30/05/2023 à 07:27, Gautier write-only address a écrit : > On Monday, May 29, 2023 at 9:56:38 PM UTC+2, DrPi wrote: > >> Just missing Alire and ALS compatibility ;) > > Alire: are you missing a LEA crate? Why not but I was thinking compiling/running Alire projects from LEA. > ALS: = Ada language server? That's it. Auto-completion and mouse-over documentation in LEA.
On Monday, May 29, 2023 at 9:56:38 PM UTC+2, DrPi wrote:
> Just missing Alire and ALS compatibility ;)
Alire: are you missing a LEA crate?
ALS: = Ada language server?
On Monday, May 29, 2023 at 9:57:43 PM UTC+2, DrPi wrote:
> What do you mean by "pure Ada" ?
IIRC, there are a few GNAT-only attributes, like Unrestricted_Access, used. No big deal.
But good point, I could check "purity" with the ObjectAda compiler.
Le 29/05/2023 à 18:29, Gautier write-only address a écrit :
> LEA is a Lightweight Editor for Ada
>
Just missing Alire and ALS compatibility ;)
Le 29/05/2023 à 18:19, Gautier write-only address a écrit :
> GWindows is a full Microsoft Windows Rapid Application Development
> framework for programming GUIs (Graphical User Interfaces) with Ada.
> GWindows works only with the GNAT development system,
> but with some effort, GWindows could be made pure Ada.
> GWindows is free and open-source!
>
What do you mean by "pure Ada" ?
LEA is a Lightweight Editor for Ada Web site: http://l-e-a.sf.net/ Source repository #1: https://sf.net/p/l-e-a/code/HEAD/tree/ Source repository #2: https://github.com/zertovitch/lea Changes since last announcement here: - Added auto insert feature: e.g. typing `(` inserts `)`. - Added color theme Solarized Light. - Added a "stealth mode" in which LEA doesn't leave traces in the registry. - Editor adds `-- ` if the cursor is within a comment when the Return key is pressed (consequence: a comment is split into two comments). - If the cursor is within a string literal when the Return key is pressed, the string literal is split into two valid string literals with a `&` between them. - Added unhandled exception information to message list - Tabs with the various file names - LEA doesn't write scilexer.dll as a file; thus, it runs as a portable application (in the sense: you can run it from a read-only drive directly, without installation) - Added a Build & Run button (for the HAC compiler). Features: - multi-document - multiple undo's & redo's - multi-line & multi-point edit, rectangular selections - color themes, easy to switch - duplication of lines and selections - syntax highlighting - parenthesis matching - bookmarks Currently available on Windows. Gtk or other implementations are possible: the LEA_Common[.*] packages are pure Ada, as well as HAC. Enjoy!
GWindows is a full Microsoft Windows Rapid Application Development framework for programming GUIs (Graphical User Interfaces) with Ada. GWindows works only with the GNAT development system, but with some effort, GWindows could be made pure Ada. GWindows is free and open-source! Changes to the framework are detailed in gwindows/changes.txt or in the News forum on the project site. In a nutshell (since last announcement here): GWindows release, 29-May-2023 [revision 480] ============================================ * Fixes: color picker dialog, mouse wheel methods 478: Contribution: added package GWindows.Pipes 477: Contribution: added package GWindows.Timers 476: Contribution: added package GWindows.Persistence_IO 466: Contribution: initial release of package Office_Applications for helping creating office-like applications. GWindows release, 13-Nov-2022 [revision 459] ============================================ 458: GWindows.Common_Controls.Ex_List_View: added `Using_Payloads` to the enumerated type `Comparison_Technique_Type`. With this choice, sorting runs 100x faster. 451: GWindows.Common_Controls.Ex_List_View: added `As_Strings_Default` to the enumerated type `Comparison_Technique_Type` (sorting runs faster if default alphabetical sorting is desired). 449: GWindows.Application: added procedure `Add_To_Recent_Documents`. Windows Explorer & Desktop puts the name on top of various "recent documents" lists, for instance in the task bar. 447: GWindows.Common_Controls.Ex_List_View: massive speedup on sorting of large lists (e.g. 6x faster for 20,000 items). GWindows release, 18-Jun-2022 [revision 440] ============================================ * Installer: ResEdit.xml configuration file for the ResEdit Resource Editor is automatically created and set up for current GNAT installation(s), GWindows and GWenerator. * Fixed a few 32/64 bit incompatibilities in GWindows.Windows and GWindows.Common_Controls.Ex_List_View. * Fixed various GNATCOM issues. GWindows Project site: https://sf.net/projects/gnavi/ GWindows GitHub clone: https://github.com/zertovitch/gwindows Enjoy! _________________________ Gautier's Ada programming http://gautiersblog.blogspot.com/search/label/Ada NB: follow the above link for a valid e-mail address
On 28/05/2023 18:25, Ingo M. wrote: > Luke A. Guest schrieb am Sonntag, 28. Mai 2023 um 17:14:51 UTC+2: >> So, what are you going to do? > > Nothing (lack of time). I just posted this in case that someone (AdaCore?) could be interested to promote Ada on raspberrypi.org. It could make sense since the Raspbery Pi is one of the most widespread PC platforms on earth right now. > I posted this on the 30th April: https://forums.raspberrypi.com/viewtopic.php?t=345110&start=50#p2103397
Ingo M. <it.marks.info@gmail.com> wrote: >The Raspberry Pi Foundation announces an "Ada Computer Science" project >which has nothing to do with the Ada programming language. >https://www.raspberrypi.org/blog/ada-computer-science/ [...] >It could be a good opportunity to promote the Ada language by providing >similar courses. [...] FWIW, I just posted the following comment on that page: "Will you also be using the Ada programming language, a modern language with a long track record of successful projects and ideally suited to develop reliable and trustworthy software?" It is currently marked as "This comment is awaiting moderation." Dirk
Le 28/05/2023 à 13:01, DrPi a écrit :
>
>> However, the biggest obstacle for using FreeDOS is hardware support.
>> FreeDOS depends upon BIOS and all motherboards since 2020 no longer
>> support BIOS. Does anybody know of any hardware produced today that
>> supports FreeDOS?
>
> Do you really need to use an old PC hardware ?
>
> On a PC (and ARM), you can also run QNX which is a real-time
> micro-kernel OS. It is a commercial product but is free for education
> and research.
>
> On PCs its is currently easy to use PCIe extension boards. Like FPGA
> boards.
>
> Also, there are very powerful non x86 (mostly ARM) hardware today. Most
> of these boards have PCIe ports to easily add extension boards.
>
>
I forgot to say that Adacore sells a Ada compiler for some QNX versions
(7.x +) but I don't know if there is a free version for education/research.
Luke A. Guest schrieb am Sonntag, 28. Mai 2023 um 17:14:51 UTC+2:
> So, what are you going to do?
Nothing (lack of time). I just posted this in case that someone (AdaCore?) could be interested to promote Ada on raspberrypi.org. It could make sense since the Raspbery Pi is one of the most widespread PC platforms on earth right now.
Regards,
Ingo
On 28/05/2023 15:06, Ingo M. wrote: > The Raspberry Pi Foundation announces an "Ada Computer Science" project which has nothing to do with the Ada programming language. Just like how AdaFruit doesn't use Ada anywhere. > https://www.raspberrypi.org/blog/ada-computer-science/ > > "We are excited to launch Ada Computer Science, the new online learning platform for teachers, students, and anyone interested in learning about computer science." > > So far the focus is set on the current ChatGPT hype, and code examples in Python, Java, VB, and C#. It could be a good opportunity to promote the Ada language by providing similar courses. Otherwise there could be a risk that newcomers associate Ada with this project rather than the language. So, what are you going to do?
> However, the biggest obstacle for using FreeDOS is hardware support. FreeDOS depends upon BIOS and all motherboards since 2020 no longer support BIOS. Does anybody know of any hardware produced today that supports FreeDOS?
Do you really need to use an old PC hardware ?
On a PC (and ARM), you can also run QNX which is a real-time
micro-kernel OS. It is a commercial product but is free for education
and research.
On PCs its is currently easy to use PCIe extension boards. Like FPGA boards.
Also, there are very powerful non x86 (mostly ARM) hardware today. Most
of these boards have PCIe ports to easily add extension boards.
On 27/05/2023 21:07, Joakim Strandberg wrote:
> Hi yet again!
>
> However, the biggest obstacle for using FreeDOS is hardware support. FreeDOS depends upon BIOS and all motherboards since 2020 no longer support BIOS. Does anybody know of any hardware produced today that supports FreeDOS?
I thought the CSM is what contains a compatibility "BIOS?"
Joakim Strandberg <joakimds@kth.se> writes: [...] > Another idea is to use the ObjectAda 7.0 compiler (free version) from > 1996 that can be downloaded here: > https://archive.org/details/ObjectAdaSE7 > It runs on Windows 95/98 but looking at the documentation for the > ObjectAda compiler it says it is possible to use the compiler to > create executables for DOS by using a DOS Extender. I haven't tried it > but should be possbile to get working. Unfortunately there are > limitations with the free version. One good thing is that it is > possible to use tasks freely for creating a FreeDOS application but > one must restrict one-self to Ada95 since the compiler is from 1996. > > There is a professional version of ObjectAda from 2002 that can be > downloaded here: > https://vetusware.com/download/ObjectAda%207.2.2%20Enterprise%207.2.2/?id=17315 > I've tested it and it works but the documentation no longer talks > about being able to create executables for FreeDOS. Maybe it can still > be used to make executables for FreeDOS? I wonder if those are authorized copies. I suspect they aren't. Aonix no longer exists, but apparently its assets are now owned by PTC, which still sells (a much newer version of) ObjectAda. https://www.ptc.com/en/products/developer-tools/objectada The copy on archive.org is of a CD whose label says "This edition of ObjectAda is not licensed for development of commercial software. This CD may not be re-sold." It does have an "All rights reserved" copyright message. (I worked for Aonix many years ago, but I have no current connection with them or their successors.) -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com Will write code for food. void Void(void) { Void(); } /* The recursive call of the void */
On 2023-05-27 17:44, Hou Van Boere wrote: > > I am thinking about using FreeDos as a kind of RTOS. The application is to control scientific instruments so portability is a non-issue. > > Can you please share bits and pieces about running Ada on FreeDos(or MS DOS) I used Ada (83) (Janus/Ada and Meridian Ada) on DOS PCs in the 80s and 90s. It was much like writing command-line applications for Linux or Windows today. I also did some low-level stuff, trapping key strokes and doing graphics. But if you're thinking of using DOS as an RTOS then that's probably not very helpful for you. RR Software (rrsoftware.com) continues to sell an Ada-83 DOS compiler, and may be able to provide an Ada-95 DOS compiler on request. Their prices are reasonable: the personal edition of their Ada-95 Windows compiler is $195. Or you could look at the MaRTE OS RTOS (https://marte.unican.es/) which is written mostly in Ada and supports GNAT compilers. I don't know how that would compare in terms of ease of getting things set up or developing S/W for it. -- Jeff Carter "Use recursive procedures for recursively- defined data structures." Elements of Programming Style 191
P.S I use less than half of Ada 95 so this compiler could help a lot.
Thanks Joakim! this is super helpful. I downloaded the compiler cd. I have tried this: https://github.com/andrewwutw/build-djgpp It looks helpful to build dlgpp but it does not work well enough on Trisquel Linux. I find that building GCC on current or old Slackware versions seems to work well and I am going to re-try this project. I know I will have to re-run with --enable-languages=c,ada later but at least it should set up most of what is needed. Your Freedos environment tips will help a lot. I just bought my son a new computer and I am kind of depressed after. The store was huge but completely geared towards gaming. It seems like today's computers are not well suited for hardware interfacing and hacking with electronics. There was way more expansion in the past and I hate having to configure for legacy bios. I think this will be dropped soon too and then we will be stuck
lördag 27 maj 2023 kl. 22:03:00 UTC+2 skrev Joakim Strandberg:
> lördag 27 maj 2023 kl. 21:49:38 UTC+2 skrev Joakim Strandberg:
> > lördag 27 maj 2023 kl. 17:44:57 UTC+2 skrev Hou Van Boere:
> > > Hi Everyone
> > >
> > > I am thinking about using FreeDos as a kind of RTOS. The application is to control scientific instruments so portability is a non-issue.
> > >
> > > Can you please share bits and pieces about running Ada on FreeDos(or MS DOS)
> > Hi,
> >
> > I wrote about how to get DJGPP compiler on DOS: https://www.reddit.com/r/ada/comments/vrhsv5/how_to_install_gnat_314b_on_freedos_13/
> > I recommend installing a recent version of DJGPP, you will be able to use a lot the Ada language except for tasking which DJGPP does not support on FreeDos.
> >
> > I have been looking for an Ada83 or Ada95 compiler for DOS which compiles real-mode executables but the ones I found are still proprietary and can be bought. It indicates there are still old systems on old hardware still in use.
> >
> > I haven't built something on DOS, just toying with the idea. I've successfully been able to execute my Advent of code solutions for 2022 on FreeDOS. I've also successfully switched to VGA mode and putting pixels on the screen and switching back to text mode from an Ada application. I did it by interfacing with C code that had assembler embedded, if I remember correctly.
> >
> > Best regards,
> > Joakim
> Hi again,
>
> Another idea is to use the ObjectAda 7.0 compiler (free version) from 1996 that can be downloaded here:
> https://archive.org/details/ObjectAdaSE7
> It runs on Windows 95/98 but looking at the documentation for the ObjectAda compiler it says it is possible to use the compiler to create executables for DOS by using a DOS Extender. I haven't tried it but should be possbile to get working. Unfortunately there are limitations with the free version. One good thing is that it is possible to use tasks freely for creating a FreeDOS application but one must restrict one-self to Ada95 since the compiler is from 1996.
>
> There is a professional version of ObjectAda from 2002 that can be downloaded here: https://vetusware.com/download/ObjectAda%207.2.2%20Enterprise%207.2.2/?id=17315
> I've tested it and it works but the documentation no longer talks about being able to create executables for FreeDOS. Maybe it can still be used to make executables for FreeDOS?
>
> Best regards,
> Joakim
Hi yet again!
However, the biggest obstacle for using FreeDOS is hardware support. FreeDOS depends upon BIOS and all motherboards since 2020 no longer support BIOS. Does anybody know of any hardware produced today that supports FreeDOS?
Best regards,
Joakim
lördag 27 maj 2023 kl. 21:49:38 UTC+2 skrev Joakim Strandberg: > lördag 27 maj 2023 kl. 17:44:57 UTC+2 skrev Hou Van Boere: > > Hi Everyone > > > > I am thinking about using FreeDos as a kind of RTOS. The application is to control scientific instruments so portability is a non-issue. > > > > Can you please share bits and pieces about running Ada on FreeDos(or MS DOS) > Hi, > > I wrote about how to get DJGPP compiler on DOS: https://www.reddit.com/r/ada/comments/vrhsv5/how_to_install_gnat_314b_on_freedos_13/ > I recommend installing a recent version of DJGPP, you will be able to use a lot the Ada language except for tasking which DJGPP does not support on FreeDos. > > I have been looking for an Ada83 or Ada95 compiler for DOS which compiles real-mode executables but the ones I found are still proprietary and can be bought. It indicates there are still old systems on old hardware still in use. > > I haven't built something on DOS, just toying with the idea. I've successfully been able to execute my Advent of code solutions for 2022 on FreeDOS. I've also successfully switched to VGA mode and putting pixels on the screen and switching back to text mode from an Ada application. I did it by interfacing with C code that had assembler embedded, if I remember correctly. > > Best regards, > Joakim Hi again, Another idea is to use the ObjectAda 7.0 compiler (free version) from 1996 that can be downloaded here: https://archive.org/details/ObjectAdaSE7 It runs on Windows 95/98 but looking at the documentation for the ObjectAda compiler it says it is possible to use the compiler to create executables for DOS by using a DOS Extender. I haven't tried it but should be possbile to get working. Unfortunately there are limitations with the free version. One good thing is that it is possible to use tasks freely for creating a FreeDOS application but one must restrict one-self to Ada95 since the compiler is from 1996. There is a professional version of ObjectAda from 2002 that can be downloaded here: https://vetusware.com/download/ObjectAda%207.2.2%20Enterprise%207.2.2/?id=17315 I've tested it and it works but the documentation no longer talks about being able to create executables for FreeDOS. Maybe it can still be used to make executables for FreeDOS? Best regards, Joakim
lördag 27 maj 2023 kl. 17:44:57 UTC+2 skrev Hou Van Boere: > Hi Everyone > > I am thinking about using FreeDos as a kind of RTOS. The application is to control scientific instruments so portability is a non-issue. > > Can you please share bits and pieces about running Ada on FreeDos(or MS DOS) Hi, I wrote about how to get DJGPP compiler on DOS: https://www.reddit.com/r/ada/comments/vrhsv5/how_to_install_gnat_314b_on_freedos_13/ I recommend installing a recent version of DJGPP, you will be able to use a lot the Ada language except for tasking which DJGPP does not support on FreeDos. I have been looking for an Ada83 or Ada95 compiler for DOS which compiles real-mode executables but the ones I found are still proprietary and can be bought. It indicates there are still old systems on old hardware still in use. I haven't built something on DOS, just toying with the idea. I've successfully been able to execute my Advent of code solutions for 2022 on FreeDOS. I've also successfully switched to VGA mode and putting pixels on the screen and switching back to text mode from an Ada application. I did it by interfacing with C code that had assembler embedded, if I remember correctly. Best regards, Joakim
Hi Everyone I am thinking about using FreeDos as a kind of RTOS. The application is to control scientific instruments so portability is a non-issue. Can you please share bits and pieces about running Ada on FreeDos(or MS DOS)
Fernando Oleo Blanco <irvise_ml@irvise.xyz> writes:
> Hi all and specially A.J.
>
> I will try to make the meeting happen. I made the announcement here [1].
>
> If you would like to participate, save the date! If you have any ideas
> or proposals, they are welcome (this goes specially to you A.J., I
> assume you would like to present :).
>
> There is a bit more info in the link if anybody else is interested. I
> will select the exact time next week.
>
> [1] https://forum.ada-lang.io/t/ada-monthly-meeting/384/2?u=irvise
The proposed time is 12:00 or 13:00 UTC on Sat 2023-06-03.
That's 05:00 or 06:00 in the US Pacific time zone (California et al).
I understand that scheduling meetings for an international audience
is hard. I might join if it's later in the day in my time zone
-- but I wouldn't have much to contribute anyway, so please don't
base your decision on that. But I suspect a lot of people in the
US won't join if it's that early.
--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */
Hi all and specially A.J. I will try to make the meeting happen. I made the announcement here [1]. If you would like to participate, save the date! If you have any ideas or proposals, they are welcome (this goes specially to you A.J., I assume you would like to present :). There is a bit more info in the link if anybody else is interested. I will select the exact time next week. [1] https://forum.ada-lang.io/t/ada-monthly-meeting/384/2?u=irvise Best regards, Fer
[-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain, Size: 10315 bytes --] ----------------------------------------------------------------------- UPDATED Call for Participation *** Early registration DEADLINE May 22 *** 27th Ada-Europe International Conference on Reliable Software Technologies (AEiC 2023) 13-16 June 2023, Lisbon, Portugal www.ada-europe.org/conference2023 Organized by Ada-Europe in cooperation with ACM SIGAda, SIGPLAN, SIGBED, the Ada Resource Association (ARA), and the University of Lisbon #AEiC2023 #AdaEurope #AdaProgramming *** Extensive info and registration online *** *** Add tutorials and/or a workshop to your conference registration *** www.ada-europe.org/conference2023/tutorials.html ----------------------------------------------------------------------- *** UPDATE Ada-Europe - AEiC 2023 early registration deadline approaching Come to the Ada-Europe conference in Lisbon, experience a packed program in an exciting town, benefit from tutorials on Tuesday, join a workshop on Friday, enjoy the social events and some sightseeing! Register now: discounted fees until May 22! http://www.ada-europe.org/conference2023/registration.html *** General Information The 27th Ada-Europe International Conference on Reliable Software Technologies (AEiC 2023) returns to Lisbon, after the 2018 edition, in the week of 13-16 June. The conference will be an in-presence only event, with a solid core of activities. The conference program includes two core days with a keynote talk, a panel, peer-reviewed academic papers, industrial presentations, and work-in-progress presentations and posters. The conference program is bracketed by one day of tutorials, and one day with two satellite events. There will be time for networking during breaks as well as during the welcome reception and the conference banquet. AEiC 2023 is the latest in a series of annual international conferences started in the early 80's, under the auspices of Ada-Europe, the international organization that promotes knowledge and use of Ada and Reliable Software in general, into academic education and research, and industrial practice. The Ada-Europe series of conferences has over the years become a leading international forum for providers, practitioners and researchers in reliable software technologies. These events highlight the increased relevance of Ada in general and in safety- and security-critical systems in particular, and provide a unique opportunity for interaction and collaboration between academics and industrial practitioners. The 2023 edition of the conference continues a number of important innovations started at the 2019 conference: - lower registration fee for conference, unified for all participants; - further reduced fee for all authors; - lower registration fee for all tutorials; - journal-based open-access publication model for peer-reviewed papers; - more compact program with two core days (Wednesday & Thursday); - tutorials on Tuesday, followed by welcome event for all participants; - satellite events on Friday. *** Overview of the Week - Tue 14: six half-day tutorials, welcome reception - Wed 15 & Thu 16: core program, conference dinner on Wednesday - Fri 17: two workshops Extensive information on AEiC 2023 is on the conference web site, such as an overview of the program, the list of accepted papers and presentations, and descriptions of workshops, tutorials, keynote presentation, panel, and social events. Also check the conference site for registration, accommodation and travel information. The Advance Program brochure will shortly be available there as well. *** Venue The conference will take place at Hotel Fénix Lisboa, in Lisbon, Portugal, which is very near downtown. It is easy to reach the hotel from the airport, by metro or taxi, and from the hotel it is possible to walk towards downtown to appreciate the inner city offerings. Portugal has been elected Europe's Leading Destination 2022 at the World Travel Awards, and Lisbon the Europe's Leading City Break Destination 2022. Portugal is also considered one of the safest countries in the world, ranking 6th place in 2022. *** Invited Speakers This year the conference will feature a keynote talk on the first day, and a panel on the second, with three invited speakers/panelists. The keynote and the panel will address topics of relevance in the conference scope, with ample time for questions and answers. - On Wed June 14, a keynote talk by Alcides Fonseca, from LASIGE, University of Lisbon Faculty of Sciences, who will talk about "Applications of liquid types for more reliable software". - On Thu June 15, a panel on the "Promises and Challenges of AI-enabled Software Development Tools for Safety-Critical Applications" will bring around the table three experts: Douglas Schmidt (Vanderbilt University, USA), Jochen Quante (Robert Bosch GmbH, Germany), and Jon Pérez Cerrolaza (IKERLAN, Spain). *** Conference Core Composition The core conference program features three distinct types of technical presentations, with different duration, in addition to the keynote talk and the pannel session: journal-track talks (30 minutes), industrial-track talks (20 minutes), work-in-progress-track talks (10 minutes). All papers presented in the journal track, the industrial track and the work-in-progress track have undergone peer review. Presentations are combined into by-theme and not by-track sessions, in order that authors and participants alike enjoy all flavors of the program in a mixed as opposed to segregated combination. Papers and Presentations: - 6 sessions: Verification and Validation 1, Advanced Systems, Reliability and Performance, Verification and Validation 2, Reliable Programming, Real-Time Systems - 6 journal-track talks - 7 industrial presentations and experience reports - 15 work-in-progress reports - posters of work-in-progress reports - submissions and accepted contributions from around the world - submissions by authors from 16 countries, and accepted contributions from Austria, Brazil, Cameroon, France, Germany, Ireland, Italy, Luxembourg, the Netherlands, Norway, Portugal, Spain, Sweden, UK, USA Networking Area: - features project posters, reserved vendor tables, and general networking options - 1 company already committed to be there: AdaCore *** Tutorials Six three-hour tutorials are offered on Tuesday 13th: - "The HAC Ada Compiler", by Gautier de Montmollin, Ada Switzerland, Switzerland - "Controlling I/O Devices with Ada and the Linux Simple I/O Library", by Philip Munts, Sweden - "Everything you Always Wanted to Know about Characters and Strings", by Jean-Pierre Rosen, Adalog, France - "Introduction to the Development of Safety Critical Software", by Jean-Pierre Rosen, Adalog, France - "Rust Fundamentals", by Luis Miguel Pinho and Tiago Carvalho, ISEP, Portugal - "Concurrency and Parallelism in Rust", by Luis Miguel Pinho and Tiago Carvalho, ISEP, Portugal *** Satellite Events Two workshops are held on Friday 16th: - 8th International Workshop on "Challenges and New Approaches for Dependable and Cyber-Physical System Engineering" (DeCPS 2023) - 2nd International Workshop "AADL by its Practitioners (ADEPT)" *** Social Program The conference provides several opportunities to socialize: - Each day: coffee breaks and sit-down lunches offer ample time for interaction and networking with participants and vendors. - Tuesday early evening: Welcome Reception in the gardens of the National Museum of Science & Natural History. During two hours, a selection of drinks and appetizers will be served and participants will have the opportunity to taste port wine while walking in the nice botanical gardens of the museum. - Wednesday evening: Conference Banquet in the "Casa do Alentejo" restaurant, downtown Lisbon. When entering the building, visitors are surprised with the several rooms of the building (an old palace that served as a casino in the XX century) featuring diverse styles and decoration. Participants will have the opportunity to taste cod fish baked in olive oil, which is a very typical Portuguese dish. *** Further Information Registration: - registration information (and link to registration form) is provided at <http://www.ada-europe.org/conference2023/registration.html> - early registration discount until Monday May 22, 2023 - payment possible by credit card or bank transfer - special low fee for authors and students - discount for Ada-Europe, ACM SIGAda, SIGBED and SIGPLAN members - registration includes coffee breaks, lunches and social events - low tutorial fees - low workshop fees - see registration page for all details Promotion: - recommended Twitter hashtags: #AEiC2023 #AdaEurope #AdaProgramming - Advance Program brochure to be available online at <http://www.ada-europe.org/conference2023/media/AP_AEiC2023.pdf> AEiC 2023 Sponsors: - AdaCore: https://www.adacore.com/ The conference is supported and sponsored by - Ada-Europe: http://www.ada-europe.org/ and organized in cooperation with - ACM SIGAda: http://www.sigada.org/ - ACM SIGBED: https://sigbed.org/ - ACM SIGPLAN: http://www.sigplan.org/ - ARA: https://www.adaic.org/community/ - Ciências ULisboa: https://ciencias.ulisboa.pt/en Please make sure you book accommodation as soon as possible. For more info and latest updates see the conference web site at <http://www.ada-europe.org/conference2023>. We look forward to seeing you in Lisbon in June 2023! ----------------------------------------------------------------------- Our apologies if you receive multiple copies of this announcement. Please circulate widely. Dirk Craeynest, AEiC 2023 Publicity Chair Dirk.Craeynest@cs.kuleuven.be * 27th Ada-Europe Int. Conf. Reliable Software Technologies (AEiC 2023) * June 13-16, 2023, Lisbon, Portugal, www.ada-europe.org/conference2023 (V6.1)
See new GCC 13.1.0 releases for aarch64-apple-darwin (i.e. Apple silicon), both native and cross compilation to arm-eabi, at https://github.com/simonjwright/distributing-gcc/releases
How can I create a console app using GNATColl. I can't find an example. I can't even find the shell.exe.
"Jeffrey R.Carter" <spam.jrcarter.not@spam.acm.org.not> writes: > On 2023-05-15 03:11, Ben Bacarisse wrote: >> Do you still have it? Does is discuss association lists? I'd call them >> a normal part of LISP and it would be odd to force the associations to >> be lists rather than pairs. Does Siklóssy imply that an ASSOC list is a >> list of lists of length 2, or does he not discuss them until the very >> end? > > The Function ASSOC is discussed in Chapter 9 as an auxiliary function used > by EVAL (Chapter 9 discusses the working of EVAL). It says > > ASSOC finds the value of a variable in the ALIST. The ALIST is a list of > sublists of two SEXes each of the form (variable > value-of-the-variable). Thanks. Is this a dialect made up for pedagogic purposes? I don't know of any practical LISP that went down this route. > Seems rather OT for c.l.a. Yes, it is. Happy to stop. I was just curious about where your use of terms originated and that now explained. -- Ben.
> Feedback: > - What is you opinion? I'm absolutely up for this. > - Do you have a topic/project that you would like to show to the > community? I recently released an Ada ISO Library for country and currency codes[1], I could talk about that if anyone is interested. I also use Ada with Alire on a mac, so I'm interested in listening to that discussion. > - Do you like the chosen time? It looks like 12pm UTC is 8am EDT. I normally get up around 6AM, so I can make this work. > - Do you like the week of the month? That should be fine. > - Is Jitsi [1] a good enough platform to do the meetings? If it works in a browser, I have no issues with it. > - Do you think that 45 min / 1 h is a good enough duration? This is good for the first such meeting. We can see how it goes and adjust in later meetings. > - Would you like to participate on Saturday 3 or Sunday 4? I prefer Saturday over Sunday, but either one works for me. AJ. [1] https://github.com/ada-iso/ada_iso/tree/v2.0.0
On 2023-05-15 12:41, Rod Kay wrote:
>
> Also, in the new binary, 'Find all references' appears to be broken (it
> finds no references). I guess, the same would apply for the refactoring tool.
> I've been advised to report the issue and will do so tomorrow. It might help to
> know if other people also experience the same problem(s), before reporting ?
After typing "with Ada.Strings." I received a use clause as a suggested
completion. After completing the subprogram name in a subprogram call, I was
shown something other than the subprogram specification. After typing the '('
for the parameter list, I was shown something other than the formal parameters.
--
Jeff Carter
"Mixtures of similar characters (letter O and
digit 0, letter I and digit 1, etc.) are unsafe,
as are long identifiers that differ only at the
end."
Elements of Programming Style
187
On 2023-05-15 03:11, Ben Bacarisse wrote:
>
> Do you still have it? Does is discuss association lists? I'd call them
> a normal part of LISP and it would be odd to force the associations to
> be lists rather than pairs. Does Siklóssy imply that an ASSOC list is a
> list of lists of length 2, or does he not discuss them until the very
> end?
The Function ASSOC is discussed in Chapter 9 as an auxiliary function used by
EVAL (Chapter 9 discusses the working of EVAL). It says
ASSOC finds the value of a variable in the ALIST. The ALIST is a list of
sublists of two SEXes each of the form (variable value-of-the-variable).
In a footnote he notes that the ALIST could be a list of dotted pairs, which are
defined in the next chapter.
I never did much with LISP after learning it, and never looked at any other
textbooks, so he might have an idiosyncratic approach. Seems rather OT for c.l.a.
--
Jeff Carter
"Mixtures of similar characters (letter O and
digit 0, letter I and digit 1, etc.) are unsafe,
as are long identifiers that differ only at the
end."
Elements of Programming Style
187
On 15/5/23 07:31, 196...@googlemail.com wrote:
> And for Linux it's an appimage. Why? I mean? Its...?
>
> I just wish they could get it into shape where the build was doable without so much hassle - I've never beenable to manage it.
The build *has* been getting easier. I maintain the Archlinux
gnatStudio package and have nearly got it to build. Currently, I'm
waiting on a new/matching release of the AdaCore spawn project. I could,
I suppose, use the latest commit version but would prefer to use a
formal release.
Also, in the new binary, 'Find all references' appears to be broken
(it finds no references). I guess, the same would apply for the
refactoring tool. I've been advised to report the issue and will do so
tomorrow. It might help to know if other people also experience the same
problem(s), before reporting ?
Regards.
"Jeffrey R.Carter" <spam.jrcarter.not@spam.acm.org.not> writes: > On 2023-05-14 17:14, Ben Bacarisse wrote: >> I never saw a LISP S-expressions defined that way. Did this list really >> no have a "dotted pair" as the basic structure with lists being simply a >> special case? > > The book I learned from (/Let's Talk LISP/ by Laurent Siklóssy, 1976) > introduces dotted pairs in chapter 10.7.1 (out of 12 chapters) on page 145 > (out of 213, excluding appendices and index). Chapter 10 deals with the > internal representation of data in LISP. The implication is that they were > not considered part of the normal use of the language. Do you still have it? Does is discuss association lists? I'd call them a normal part of LISP and it would be odd to force the associations to be lists rather than pairs. Does Siklóssy imply that an ASSOC list is a list of lists of length 2, or does he not discuss them until the very end? > S-expressions, on the other hand, are introduced in chapter 1.1 on page > 2. The book also presents the grammar > > S-expression ::= atom | list > list ::= '(' inside ')' > inside ::= empty | S-expression | S-expression inside > empty ::= That's an interesting way to simplify things for the leaner though I would not have chosen to use a term that already had another meaning by 1976. The author could have used something like L-expression and avoided any future confusion. -- Ben.
On 2023-05-14 17:14, Ben Bacarisse wrote:
>
> I never saw a LISP S-expressions defined that way. Did this list really
> no have a "dotted pair" as the basic structure with lists being simply a
> special case?
The book I learned from (/Let's Talk LISP/ by Laurent Siklóssy, 1976) introduces
dotted pairs in chapter 10.7.1 (out of 12 chapters) on page 145 (out of 213,
excluding appendices and index). Chapter 10 deals with the internal
representation of data in LISP. The implication is that they were not considered
part of the normal use of the language.
S-expressions, on the other hand, are introduced in chapter 1.1 on page 2. The
book also presents the grammar
S-expression ::= atom | list
list ::= '(' inside ')'
inside ::= empty | S-expression | S-expression inside
empty ::=
--
Jeff Carter
"Don't knock masturbation. It's sex with someone I love."
Annie Hall
45
"Jeffrey R.Carter" <spam.jrcarter.not@spam.acm.org.not> writes:
> On 2023-05-14 08:46, J-P. Rosen wrote:
>> Of course, in LISP there is only one structure, for data and programs
>> alike: the list!
>
> In the LISP I learned, there were only S-expressions (SEXes). A SEX is
> either an atom or a list of SEXes.
I never saw a LISP S-expressions defined that way. Did this list really
no have a "dotted pair" as the basic structure with lists being simply a
special case?
--
Ben.
Le 14/05/2023 à 12:39, Jeffrey R.Carter a écrit : > On 2023-05-14 08:46, J-P. Rosen wrote: >> >> Of course, in LISP there is only one structure, for data and programs >> alike: the list! > > In the LISP I learned, there were only S-expressions (SEXes). A SEX is > either an atom or a list of SEXes. Another way of putting it was there > were atoms and lists of atoms or lists. Either way, there were also atoms. > Right, but I would define atoms as the basic data, not a data /structure/. Oh well, just a matter of definition... -- J-P. Rosen Adalog 2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX https://www.adalog.fr https://www.adacontrol.fr
Hi Luke I knew someone would mention this :) Most people program in lowercase with COBOL now. It is a personal preference. I use a smaller font and have more code on the screen with uppercase and I am just kinda retro about a lot of things. Think Amish using a computer :)
On 14 May 2023, J-P. Rosen wrote
(in article <u3q03n$2iba1$1@dont-email.me>):
> Le 13/05/2023 à 18:53, Niklas Holsti a écrit:
> > > What about COBOL and LISP?
> >
> >
> > As I understand it (but I don't claim to be expert), the early COBOL
> > languages could describe the structure of file records, and of
> > working-storage objects, as nested sequences of components and
> > sub-records, but each such description defined a _single_ "record"
> > object, not a "record" data-type that could have many instances. So if
> > you wanted to have two record objects with the same structure, you had
> > to duplicate the whole record description.
> AFAIR, COBOL didn't have types, but you could define a variable LIKE
> another one.
LIKE is PL/I.
--
Bill Findlay
On 2023-05-14 08:46, J-P. Rosen wrote:
>
> Of course, in LISP there is only one structure, for data and programs alike: the
> list!
In the LISP I learned, there were only S-expressions (SEXes). A SEX is either an
atom or a list of SEXes. Another way of putting it was there were atoms and
lists of atoms or lists. Either way, there were also atoms.
--
Jeff Carter
"Don't knock masturbation. It's sex with someone I love."
Annie Hall
45
"J-P. Rosen" <rosen@adalog.fr> writes:
> Of course, in LISP there is only one structure, for data and programs
> alike: the list!
LISP had S-expressions -- pairs of atoms or other S-expressions. A list
was just a special case. Many other structures could be built using
S-expressions. An important one was that association list -- a list of
(key . value) pairs that was often used very much like a record type
(though it's quite a different beast).
--
Ben.
On 2023-05-14 9:46, J-P. Rosen wrote:
> Le 13/05/2023 à 18:53, Niklas Holsti a écrit :
>>> What about COBOL and LISP?
>>
>>
>> As I understand it (but I don't claim to be expert), the early COBOL
>> languages could describe the structure of file records, and of
>> working-storage objects, as nested sequences of components and
>> sub-records, but each such description defined a _single_ "record"
>> object, not a "record" data-type that could have many instances. So if
>> you wanted to have two record objects with the same structure, you had
>> to duplicate the whole record description.
> AFAIR, COBOL didn't have types, but you could define a variable LIKE
> another one.
So I also remembered, but (before writing the above) I looked through
some COBOL syntaxes on the net and could not find LIKE as part of the
data division syntax.
However, after more searching, I see that at least current Microfocus
RM-COBOL supports a "SAME AS" definition that has that effect. I don't
know when that feature was introduced. I did not find it in the current
IBM COBOL description.
In Microfocus RM-COBOL, the LIKE word can be used as a boolean relation
that compares the content of a variable to a pattern, like a regexp
match. I did not find this kind of relation in IBM COBOL.
Another way to clone a COBOL record structure is to put the record
structure description in a separate source-code file, and COPY that file
(like C "include") into the declaration of any object that should have
that structure. But ugh. And it could make a mess of the "level
numbers", where the RM-COBOL SAME AS definition adjusts those automatically.
On 14/05/2023 01:17, Hou Van Boere wrote:
> Hi Everyone
>
> Just a little cross post:
> https://sourceforge.net/p/gnucobol/discussion/cobol/thread/5f771109ad/
>
> I am having so much fun with Ada again. I think the foreign binding examples on the net are horrible. With little wimpy inline packages, you can bring foreign code in easily.
>
> Everyone complains about C but a teenager can fool around with it on a weekend and end up a C programmer a few years later. Ada does not present this way but it fact it is easy to write little wimpy programs in it just for fun and even wimpy programs will often need non-Ada libraries.
>
> -Pat
It's not 1979 anymore, you can use unicode in Ada and even lowercase
letters. This is not Oberon where the language is stuck in the 70's
where there was a limited character set available on keyboards. I think
even COBOL can now accept lower case keywords now, but I'm not sure
about this.
On 14/05/2023 08:20, Nasser M. Abbasi wrote:
> I think RECORD is the most important data structure myself.
>
> Without a RECORD (called struct in C), programming
> is much harder. This is what Java and Python have discovered
> just now. I guess the language designers of these
> languages never bothered to look at Pascal or Ada before.
>
> But better late than never I guess.
I think people might finally be realising that you can't do everything
with only one programming paradigm.
On 14/05/2023 07:46, J-P. Rosen wrote:
> Of course, in LISP there is only one structure, for data and programs
> alike: the list!
Well, that's not true anymore, especially not in common lisp which has a
variety of data structures including records, I was quite surprised to
see that when I was looking at it last year.
On 14/05/2023 07:46, J-P. Rosen wrote:
> AFAIR, COBOL didn't have types, but you could define a variable LIKE
> another one.
>
>> However, Wikipedia says that the COBOL record structure inspired
>> records for Pascal.
>>
>> Early LISP languages did not have record types, AFAIK. But you could
>> of course use lists to program record-like data structures.
> Of course, in LISP there is only one structure, for data and programs
> alike: the list!
>
TBH, I don't really remember anything of COBOL apart from pictures and
columns.
On 5/14/2023 1:46 AM, J-P. Rosen wrote: > Le 13/05/2023 à 18:53, Niklas Holsti a écrit : >> for Pascal. >> >> Early LISP languages did not have record types, AFAIK. But you could of >> course use lists to program record-like data structures. > Of course, in LISP there is only one structure, for data and programs > alike: the list! > This is similar to Mathematica. I programmed a little in lisp, and it was kinda fun. In Mathematica, its main data struct is also the list and list of lists and list of list of lists and so on. a={1,2,3}; a={{1,2,3},{4,5,6}}; Everything in Mathematica is pretty much build using lists. Few years ago, Wolfram introduced Association, which acts like a RECORD. It is really like a dictionary. It has key->value pairs so one can do: myData = <| "name"->"me","age"->99 |> To read value of a field one uses myData["name"] or myData["age"]. It is amazing how people can program so much code using only just a list as the main basic data structure and be able to get away with it :) I think RECORD is the most important data structure myself. Without a RECORD (called struct in C), programming is much harder. This is what Java and Python have discovered just now. I guess the language designers of these languages never bothered to look at Pascal or Ada before. But better late than never I guess. --Nasser
Le 13/05/2023 à 18:53, Niklas Holsti a écrit : >> What about COBOL and LISP? > > > As I understand it (but I don't claim to be expert), the early COBOL > languages could describe the structure of file records, and of > working-storage objects, as nested sequences of components and > sub-records, but each such description defined a _single_ "record" > object, not a "record" data-type that could have many instances. So if > you wanted to have two record objects with the same structure, you had > to duplicate the whole record description. AFAIR, COBOL didn't have types, but you could define a variable LIKE another one. > However, Wikipedia says that the COBOL record structure inspired records > for Pascal. > > Early LISP languages did not have record types, AFAIK. But you could of > course use lists to program record-like data structures. Of course, in LISP there is only one structure, for data and programs alike: the list! -- J-P. Rosen Adalog 2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX https://www.adalog.fr https://www.adacontrol.fr
Hi Everyone Just a little cross post: https://sourceforge.net/p/gnucobol/discussion/cobol/thread/5f771109ad/ I am having so much fun with Ada again. I think the foreign binding examples on the net are horrible. With little wimpy inline packages, you can bring foreign code in easily. Everyone complains about C but a teenager can fool around with it on a weekend and end up a C programmer a few years later. Ada does not present this way but it fact it is easy to write little wimpy programs in it just for fun and even wimpy programs will often need non-Ada libraries. -Pat
On 2023-05-13 14:18, Luke A. Guest wrote:
> On 13/05/2023 08:13, Niklas Holsti wrote:
>
>>> Pascal had them in 1970. Algol, I think, had them in 1960.
>>
>>
>> Algol 60 did not have records, only arrays.
>>
>> Algol W, a precursor to Pascal, had them in 1966.
>>
>> Simula had them in 1967. (Wikipedia says "In 1966 C. A. R. Hoare
>> introduced the concept of record class construct".)
>>
>> Algol 68 had them in 1968.
>>
>> Pascal had them in 1970, as you say.
>>
>
> What about COBOL and LISP?
As I understand it (but I don't claim to be expert), the early COBOL
languages could describe the structure of file records, and of
working-storage objects, as nested sequences of components and
sub-records, but each such description defined a _single_ "record"
object, not a "record" data-type that could have many instances. So if
you wanted to have two record objects with the same structure, you had
to duplicate the whole record description.
However, Wikipedia says that the COBOL record structure inspired records
for Pascal.
Early LISP languages did not have record types, AFAIK. But you could of
course use lists to program record-like data structures.
On 13/05/2023 08:13, Niklas Holsti wrote:
>> Pascal had them in 1970. Algol, I think, had them in 1960.
>
>
> Algol 60 did not have records, only arrays.
>
> Algol W, a precursor to Pascal, had them in 1966.
>
> Simula had them in 1967. (Wikipedia says "In 1966 C. A. R. Hoare
> introduced the concept of record class construct".)
>
> Algol 68 had them in 1968.
>
> Pascal had them in 1970, as you say.
>
What about COBOL and LISP?
On 2023-05-13 0:33, Jeffrey R.Carter wrote: > On 2023-05-12 19:50, Nasser M. Abbasi wrote: >> >> Java 14 now have "Record" ! >> >> And Python 3.7 now has records, they call it "data class" >> >> What took them so long? Pascal and Ada had records >> from day one, only 40 years ago or so. Java and Python have classes, which have records as a special case, if the term "record" is understood as in most other languages, including Ada. But it seems that the Java 14 "record" is not quite the same as an Ada record, because Java 14 records are meant to be immutable data carriers, not mutable data structures. Still, Java 14 records are described as a (very) special case of classes. > Pascal had them in 1970. Algol, I think, had them in 1960. Algol 60 did not have records, only arrays. Algol W, a precursor to Pascal, had them in 1966. Simula had them in 1967. (Wikipedia says "In 1966 C. A. R. Hoare introduced the concept of record class construct".) Algol 68 had them in 1968. Pascal had them in 1970, as you say.
Okay, thank you all for the information. Regards.
On 2023-05-12 19:50, Nasser M. Abbasi wrote:
>
> Java 14 now have "Record" !
>
> And Python 3.7 now has records, they call it "data class"
>
> What took them so long? Pascal and Ada had records
> from day one, only 40 years ago or so.
Pascal had them in 1970. Algol, I think, had them in 1960.
--
Jeff Carter
"Many times we're given rhymes that are quite unsingable."
Monty Python and the Holy Grail
57
On 5/12/23 13:50, Nasser M. Abbasi wrote:
>
> Java 14 now have "Record" !
>
> " records are meant to be data carriers"
>
> https://www.digitalocean.com/community/tutorials/java-records-class
>
> And Python 3.7 now has records, they call it "data class"
>
> https://realpython.com/python-data-classes/
>
> "One new and exciting feature coming in Python 3.7 is the data class.
> A data class is a class typically containing mainly data"
>
> What took them so long? Pascal and Ada had records
> from day one, only 40 years ago or so.
>
> --Nasser
>
And Cobol had them 63 years ago.
AARM 3.5.3(1.a), 13.4(8.b, 10/5) has some information about boolean representations.
Java 14 now have "Record" ! " records are meant to be data carriers" https://www.digitalocean.com/community/tutorials/java-records-class And Python 3.7 now has records, they call it "data class" https://realpython.com/python-data-classes/ "One new and exciting feature coming in Python 3.7 is the data class. A data class is a class typically containing mainly data" What took them so long? Pascal and Ada had records from day one, only 40 years ago or so. --Nasser
On 2023-05-12 15:17, Rod Kay wrote:
> Surely only the least significant bit of the least significant byte
> is relevant and so the value cannot be garbled by one task writing and
> another reading at the same time ?
That seems very likely indeed, unless (as others have commented) the
representation has been specified to use more bits. However, the Ada RM
states in C.6(8/3) that "every atomic type or object is also defined to
be volatile", and of course Boolean variables are not considered
volatile unless they are specified to be Atomic or Volatile. So a
Boolean type is not inherently atomic in the Ada RM sense of "atomic".
And of course if you use a shared variable to communicate data between
tasks, that variable should be marked as Volatile, and there should also
be some Atomic accesses to ensure that actions are "sequential", so
marking the variable as Atomic is best.
Le 12/05/2023 à 14:53, Jeffrey R.Carter a écrit : > On 2023-05-12 14:17, Rod Kay wrote: >> Surely only the least significant bit of the least significant >> byte is relevant and so the value cannot be garbled by one task >> writing and another reading at the same time ? > > Boolean types with other representations using multiple bits are > possible, so your assumption doesn't hold. > True, especially considering the special exception for boolean types in 13.4(8) Anyway, if you intend to access a variable from multiple tasks, it doesn't cost much to add an aspect Atomic to the declaration, at least to inform the reader! -- J-P. Rosen Adalog 2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX https://www.adalog.fr https://www.adacontrol.fr
On 2023-05-12 14:17, Rod Kay wrote:
> Surely only the least significant bit of the least significant byte is
> relevant and so the value cannot be garbled by one task writing and another
> reading at the same time ?
Boolean types with other representations using multiple bits are possible, so
your assumption doesn't hold.
--
Jeff Carter
"Many times we're given rhymes that are quite unsingable."
Monty Python and the Holy Grail
57
Surely only the least significant bit of the least significant byte is relevant and so the value cannot be garbled by one task writing and another reading at the same time ? Regards.
On 10.05.23 21:47, Ben Bacarisse wrote:
> Presumably 3rd or 4th June.
>
Ouch, true! June, not July... Thanks for catching the mistake!
[-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain, Size: 9886 bytes --] ----------------------------------------------------------------------- Call for Participation *** PROGRAM SUMMARY *** 27th Ada-Europe International Conference on Reliable Software Technologies (AEiC 2023) 13-16 June 2023, Lisbon, Portugal www.ada-europe.org/conference2023 Organized by Ada-Europe in cooperation with ACM SIGAda, SIGPLAN, SIGBED, the Ada Resource Association (ARA), and the University of Lisbon #AEiC2023 #AdaEurope #AdaProgramming *** Online registration open *** *** Highly recommended to book your hotel ASAP *** *** Early registration discount until May 22 *** ----------------------------------------------------------------------- *** General Information The 27th Ada-Europe International Conference on Reliable Software Technologies (AEiC 2023) returns to Lisbon, after the 2018 edition, in the week of 13-16 June. The conference will be an in-presence only event, with a solid core of activities. The conference program includes two core days with a keynote talk, a panel, peer-reviewed academic papers, industrial presentations, and work-in-progress presentations and posters. The conference program is bracketed by one day of tutorials, and one day with two satellite events. There will be time for networking during breaks as well as during the welcome reception and the conference banquet. AEiC 2023 is the latest in a series of annual international conferences started in the early 80's, under the auspices of Ada-Europe, the international organization that promotes knowledge and use of Ada and Reliable Software in general, into academic education and research, and industrial practice. The Ada-Europe series of conferences has over the years become a leading international forum for providers, practitioners and researchers in reliable software technologies. These events highlight the increased relevance of Ada in general and in safety- and security-critical systems in particular, and provide a unique opportunity for interaction and collaboration between academics and industrial practitioners. The 2023 edition of the conference continues a number of important innovations started at the 2019 conference: - lower registration fee for conference, unified for all participants; - further reduced fee for all authors; - lower registration fee for all tutorials; - journal-based open-access publication model for peer-reviewed papers; - more compact program with two core days (Wednesday & Thursday); - tutorials on Tuesday, followed by welcome event for all participants; - satellite events on Friday. *** Overview of the Week - Tue 14: six half-day tutorials, welcome reception - Wed 15 & Thu 16: core program, conference dinner on Wednesday - Fri 17: two workshops Extensive information on AEiC 2023 is on the conference web site, such as an overview of the program, the list of accepted papers and presentations, and descriptions of workshops, tutorials, keynote presentation, panel, and social events. Also check the conference site for registration, accommodation and travel information. The Advance Program brochure will shortly be available there as well. *** Venue The conference will take place at Hotel Fénix Lisboa, in Lisbon, Portugal, which is very near downtown. It is easy to reach the hotel from the airport, by metro or taxi, and from the hotel it is possible to walk towards downtown to appreciate the inner city offerings. Portugal has been elected Europe's Leading Destination 2022 at the World Travel Awards, and Lisbon the Europe's Leading City Break Destination 2022. Portugal is also considered one of the safest countries in the world, ranking 6th place in 2022. *** Invited Speakers This year the conference will feature a keynote talk on the first day, and a panel on the second, with three invited speakers/panelists. The keynote and the panel will address topics of relevance in the conference scope, with ample time for questions and answers. - On Wed June 14, a keynote talk by Alcides Fonseca, from LASIGE, University of Lisbon Faculty of Sciences, who will talk about "Applications of liquid types for more reliable software". - On Thu June 15, a panel on the "Promises and Challenges of AI-enabled Software Development Tools for Safety-Critical Applications" will bring around the table three experts: Douglas Schmidt (Vanderbilt University, USA), Jochen Quante (Robert Bosch GmbH, Germany), and Jon Pérez Cerrolaza (IKERLAN, Spain). *** Conference Core Composition The core conference program features three distinct types of technical presentations, with different duration, in addition to the keynote talk and the pannel session: journal-track talks (30 minutes), industrial-track talks (20 minutes), work-in-progress-track talks (10 minutes). All papers presented in the journal track, the industrial track and the work-in-progress track have undergone peer review. Presentations are combined into by-theme and not by-track sessions, in order that authors and participants alike enjoy all flavors of the program in a mixed as opposed to segregated combination. Papers and Presentations: - 6 sessions: Verification and Validation 1, Advanced Systems, Reliability and Performance, Verification and Validation 2, Reliable Programming, Real-Time Systems - 6 journal-track talks - 7 industrial presentations and experience reports - 15 work-in-progress reports - posters of work-in-progress reports - submissions and accepted contributions from around the world - submissions by authors from 16 countries, and accepted contributions from Austria, Brazil, Cameroon, France, Germany, Ireland, Italy, Luxembourg, the Netherlands, Norway, Portugal, Spain, Sweden, UK, USA Networking Area: - features project posters, reserved vendor tables, and general networking options - 1 company already committed to be there: AdaCore *** Tutorials Six three-hour tutorials are offered on Tuesday 13th: - "The HAC Ada Compiler", by Gautier de Montmollin, Ada Switzerland, Switzerland - "Controlling I/O Devices with Ada and the Linux Simple I/O Library", by Philip Munts, Sweden - "Everything you Always Wanted to Know about Characters and Strings", by Jean-Pierre Rosen, Adalog, France - "Introduction to the Development of Safety Critical Software", by Jean-Pierre Rosen, Adalog, France - "Rust Fundamentals", by Luis Miguel Pinho and Tiago Carvalho, ISEP, Portugal - "Concurrency and Parallelism in Rust", by Luis Miguel Pinho and Tiago Carvalho, ISEP, Portugal *** Satellite Events Two workshops are held on Friday 16th: - 8th International Workshop on "Challenges and New Approaches for Dependable and Cyber-Physical System Engineering" (DeCPS 2023) - 2nd International Workshop "AADL by its Practitioners (ADEPT)" *** Social Program The conference provides several opportunities to socialize: - Each day: coffee breaks and sit-down lunches offer ample time for interaction and networking with participants and vendors. - Tuesday early evening: Welcome Reception in the gardens of the National Museum of Science & Natural History. During two hours, a selection of drinks and appetizers will be served and participants will have the opportunity to taste port wine while walking in the nice botanical gardens of the museum. - Wednesday evening: Conference Banquet in the "Casa do Alentejo" restaurant, downtown Lisbon. When entering the building, visitors are surprised with the several rooms of the building (an old palace that served as a casino in the XX century) featuring diverse styles and decoration. Participants will have the opportunity to taste cod fish baked in olive oil, which is a very typical Portuguese dish. *** Further Information Registration: - registration information (and link to registration form) is provided at <http://www.ada-europe.org/conference2023/registration.html> - early registration discount until Monday May 22, 2023 - payment possible by credit card or bank transfer - special low fee for authors and students - discount for Ada-Europe, ACM SIGAda, SIGBED and SIGPLAN members - registration includes coffee breaks, lunches and social events - low tutorial fees - low workshop fees - see registration page for all details Promotion: - recommended Twitter hashtags: #AEiC2023 #AdaEurope #AdaProgramming - Advance Program brochure to be available online at <http://www.ada-europe.org/conference2023/media/AP_AEiC2023.pdf> AEiC 2023 Sponsors: - AdaCore: https://www.adacore.com/ The conference is supported and sponsored by - Ada-Europe: http://www.ada-europe.org/ and organized in cooperation with - ACM SIGAda: http://www.sigada.org/ - ACM SIGBED: https://sigbed.org/ - ACM SIGPLAN: http://www.sigplan.org/ - ARA: https://www.adaic.org/community/ - Ciências ULisboa: https://ciencias.ulisboa.pt/en Please make sure you book accommodation as soon as possible. For more info and latest updates see the conference web site at <http://www.ada-europe.org/conference2023>. We look forward to seeing you in Lisbon in June 2023! ----------------------------------------------------------------------- Our apologies if you receive multiple copies of this announcement. Please circulate widely. Dirk Craeynest, AEiC 2023 Publicity Chair Dirk.Craeynest@cs.kuleuven.be * 27th Ada-Europe Int. Conf. Reliable Software Technologies (AEiC 2023) * June 13-16, 2023, Lisbon, Portugal, www.ada-europe.org/conference2023 (V5.1)
----------------------------------------------------------------------- Ada-Belgium Spring 2023 Event Sunday, May 28, 2023, 12:00-19:00 Leuven, Belgium including at 15:00 2023 Ada-Belgium General Assembly and at 16:00 Ada Round-Table Discussion http://www.cs.kuleuven.be/~dirk/ada-belgium/events/23/230528-abga.html ----------------------------------------------------------------------- *** Announcement The next Ada-Belgium event will take place on Sunday, May 28, 2023 in Leuven. After an interruption of 3 years due to the COVID-19 pandemic, and for the 13th time, Ada-Belgium organizes their "Spring Event", which starts at noon, runs until 7pm, and includes an informal lunch, the 30th General Assembly of the organization, and a round-table discussion on Ada-related topics the participants would like to bring up. *** Schedule * 12:00 welcome and getting started (please be there!) * 12:15 informal lunch * 15:00 Ada-Belgium General Assembly * 16:00 Ada round-table + informal discussions * 19:00 end *** Participation Everyone interested (members and non-members alike) is welcome at any or all parts of this event. For practical reasons registration is required. If you would like to attend, please send an email before Thursday, May 25, 18:00, to Dirk Craeynest <Dirk.Craeynest@cs.kuleuven.be> with the subject "Ada-Belgium Spring 2023 Event", so you can get precise directions to the place of the meeting. Even if you already responded to the preliminary announcement, please reconfirm your participation ASAP. If you are interested to join Ada-Belgium, please register by filling out the 2023 membership application form[1] and by paying the appropriate fee before the General Assembly. After payment you will receive a receipt from our treasurer and you are considered a member of the organization for the year 2023 with all member benefits[2]. Early enrollment ensures you receive the full Ada-Belgium membership benefits (including the Ada-Europe indirect membership benefits package). As mentioned at earlier occasions, we have a limited stock of documentation sets and Ada related CD-ROMs that were distributed at previous events, as well as some back issues of the Ada User Journal[3]. These will be available on a first-come first-serve basis at the General Assembly for current and new members. (Please indicate in the above-mentioned registration e-mail that you're interested, so we can bring enough copies.) [1] http://www.cs.kuleuven.be/~dirk/ada-belgium/forms/member-form23.html [2] http://www.cs.kuleuven.be/~dirk/ada-belgium/member-benefit.html [3] http://www.ada-europe.org/auj/home/ *** Informal lunch The organization will provide food and beverage to all Ada-Belgium members. Non-members who want to participate at the lunch are also welcome: they can choose to join the organization or pay the sum of 20 Euros per person to the Treasurer of the organization. *** General Assembly All Ada-Belgium members have a vote at the General Assembly, can add items to the agenda, and can be a candidate for a position on the Board[4]. See the separate official convocation[5] for all details. [4] http://www.cs.kuleuven.be/~dirk/ada-belgium/board/ [5] http://www.cs.kuleuven.be/~dirk/ada-belgium/events/23/230528-abga-conv.html *** Ada Round-Table Discussion As in recent years, we plan to keep the technical part of the Spring event informal as well. We will have a round-table discussion on Ada-related topics the participants would like to bring up. We invite everyone to briefly mention how they are using Ada in their work or non-work environment, and/or what kind of Ada-related activities they would like to embark on. We hope this might spark some concrete ideas for new activities and collaborations. *** Directions To permit this more interactive and social format, the event takes place at private premises in Leuven. As instructed above, please inform us by e-mail if you would like to attend, and we'll provide you precise directions to the place of the meeting. Obviously, the number of participants we can accommodate is not unlimited, so don't delay... Looking forward to meet many of you! Dirk Craeynest President Ada-Belgium Dirk.Craeynest@cs.kuleuven.be ----------------------------------------------------------------------- Acknowledgements We would like to thank our sponsors for their continued support of our activities: AdaCore, and KU Leuven (University of Leuven). If you would also like to support Ada-Belgium, find out about the extra Ada-Belgium sponsorship benefits: http://www.cs.kuleuven.be/~dirk/ada-belgium/member-benefit.html#sponsor ----------------------------------------------------------------------- (V20230511.1)
Fernando Oleo Blanco <irvise_ml@irvise.xyz> writes:
> * When do "we" start?
>
> As I would not like to postpone it much more, I would like to
> kickstart it this June. So the first one would be either Saturday 3
> or Sunday 4 of July.
Presumably 3rd or 4th June.
--
Ben.
On 2023-05-10 17:39, Fernando Oleo Blanco wrote:
>
> - Do you like the chosen time?
Any time will be inconvenient for some, but one must be chosen. 12:00 UTC is
fine with me, but during January, the time on the west coast of the US is UTC
-08, and on the east coast of Austrailia, UTC +11. 12:00 UTC corresponds to
04:00 in California and 23:00 in Sydney. 04:00 is rather painful. It might be
better to choose 13:00 UTC (05:00 and 00:00).
--
Jeff Carter
"Brave Sir Robin ran away."
Monty Python and the Holy Grail
59
Fernando Oleo Blanco <irvise_ml@irvise.xyz> writes: > - What is you opinion? Good idea. > - Do you have a topic/project that you would like to show to the > community? Will have to think about that! Mac issues? Alire vs Mac? > - Do you like the chosen time? Fine by me. > - Do you like the week of the month? No problem > - Is Jitsi [1] a good enough platform to do the meetings? Will have to see! > - Do you think that 45 min / 1 h is a good enough duration? Certainly OK for the first meeting > - Would you like to participate on Saturday 3 or Sunday 4? Either could be managed! Slight preference for Saturday --S
* Reboot of the Ada Monthly Meeting Dear all. Once again, after a long pause, I want to revive the idea of a monthly meeting to discuss the latest Ada events, projects, releases or just have a chat about a topic. I will not repeat what I said in the original message as all points still stand. I was happy with the reception that the proposal gathered, alas it did not take place. However, I was thinking about having one at the beginning of each month. There would be a pause during summer (August for most people and potentially September) and FOSDEM. * When do "we" start? As I would not like to postpone it much more, I would like to kickstart it this June. So the first one would be either Saturday 3 or Sunday 4 of July. I know this sounds a bit rushed. However, if I do not set a date for me and other people, we will just keep pushing it further and further. This firt meetup would just be to test the waters and receive feedback. There would be another one in July and then summer, after which I hope to get a serious and continuous stream of meetups. I was thinking that we could have a meetup at around 12PM UTC time. It is early but not crazy early for those in USA and late for those in far east Asia such as Australia. Here in Europe it falls close to the meal time, which is not ideal... If a lot of people do not like this time, it can be easily moved a bit earlier or later... I WOULD LIKE TO RECEIVE SOME FEEDBACK ON THIS. * What to expect? I would like to keep this meetups sweet and short. I was thinking maybe 45 minutes long, maybe an hour. That would allow for a quick round of news, topics and introductions (something like what Maxim Reznik does but a lot shorter). Then 2 to 4 topics (depending on the time needed by each one). The topics would be what other and I already proposed. This would give between 20 to 10 minutes for each topic. Once again, this is the starting proposal. Adjustments will be needed. * What do I need? Feedback: - What is you opinion? - Do you have a topic/project that you would like to show to the community? - Do you like the chosen time? - Do you like the week of the month? - Is Jitsi [1] a good enough platform to do the meetings? - Do you think that 45 min / 1 h is a good enough duration? - Would you like to participate on Saturday 3 or Sunday 4? [1] https://meet.jit.si/ Once again, best regards, Fer
Jeffrey R.Carter schrieb am Mittwoch, 10. Mai 2023 um 11:46:40 UTC+2:
> https://www.iso.org/standard/83621.html
Has anyone viewed the preview available on this site? The ToC is very different from Draft 35.
Nasser M. Abbasi schrieb am Mittwoch, 10. Mai 2023 um 16:27:21 UTC+2: > Is there a site that gives summary of new features/changes/improvements > in Ada 2023? Yes, Ada now has an ARM and a LEG (langauage enhancement guide), see: http://www.ada-auth.org/standards/overview22.html
On 5/10/2023 4:45 AM, Jeffrey R.Carter wrote:
> https://www.iso.org/standard/83621.html
>
Is there a site that gives summary of new features/changes/improvements
in Ada 2023?
--Nasser
https://www.iso.org/standard/83621.html -- Jeff Carter "Brave Sir Robin ran away." Monty Python and the Holy Grail 59
Fabien Chouteau <fabien.chouteau@gmail.com> wrote:
>The 2023 Stack Overflow survey is live:
>https://stackoverflow.blog/2023/05/08/the-2023-developer-survey-is-now-live/
>And for the first time Ada is listed in the options for "programming,
>scripting, and markup languages"!
>
>Don't hesitate to fill the survey and show that the Ada community is alive.
Done!
Dirk
Dirk.Craeynest@cs.kuleuven.be (for Ada-Belgium/Ada-Europe/SIGAda/WG9)
* 27th Ada-Europe Int. Conf. Reliable Software Technologies (AEiC 2023)
* June 13-16, 2023, Lisbon, Portugal, www.ada-europe.org/conference2023
On 2023-05-09 11:39, Fabien Chouteau wrote:
> The 2023 Stack Overflow survey is live: https://stackoverflow.blog/2023/05/08/the-2023-developer-survey-is-now-live/
> And for the first time Ada is listed in the options for "programming, scripting, and markup languages"!
>
> Don't hesitate to fill the survey and show that the Ada community is alive.
Done
--
/Björn
On Tuesday, May 9, 2023 at 5:39:58 AM UTC-4, Fabien Chouteau wrote:
> The 2023 Stack Overflow survey is live: https://stackoverflow.blog/2023/05/08/the-2023-developer-survey-is-now-live/
> And for the first time Ada is listed in the options for "programming, scripting, and markup languages"!
>
> Don't hesitate to fill the survey and show that the Ada community is alive.
Done.
Fabien Chouteau <fabien.chouteau@gmail.com> writes:
> The 2023 Stack Overflow survey is live:
> https://stackoverflow.blog/2023/05/08/the-2023-developer-survey-is-now-live/
> And for the first time Ada is listed in the options for "programming,
> scripting, and markup languages"!
>
> Don't hesitate to fill the survey and show that the Ada community is alive.
Done. I left the AI sections blank ...
On 2023-05-09 14:17, Luke A. Guest wrote: > On 09/05/2023 11:56, Dmitry A. Kazakov wrote: >> On 2023-05-09 11:39, Fabien Chouteau wrote: >> >>> Don't hesitate to fill the survey and show that the Ada community is >>> alive. >> >> Finished >> >> P.S. It appeared to me rather unfocused and pointless. > > TBH, I think for us, it's more a matter of piling on the Ada tick box > than anything else. Their focus is more on AI. Of course. But "bridge to sell you" felt quite uncomfortable. Then this AI scam is yet another step away from decent software engineering, Ada is a part of. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
On 09/05/2023 11:56, Dmitry A. Kazakov wrote:
> On 2023-05-09 11:39, Fabien Chouteau wrote:
>
>> Don't hesitate to fill the survey and show that the Ada community is
>> alive.
>
> Finished
>
> P.S. It appeared to me rather unfocused and pointless.
>
TBH, I think for us, it's more a matter of piling on the Ada tick box
than anything else. Their focus is more on AI.
Le 09/05/2023 à 11:39, Fabien Chouteau a écrit :
> The 2023 Stack Overflow survey is live: https://stackoverflow.blog/2023/05/08/the-2023-developer-survey-is-now-live/
> And for the first time Ada is listed in the options for "programming, scripting, and markup languages"!
>
> Don't hesitate to fill the survey and show that the Ada community is alive.
Done
On 2023-05-09 11:39, Fabien Chouteau wrote: > Don't hesitate to fill the survey and show that the Ada community is alive. Finished P.S. It appeared to me rather unfocused and pointless. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
On 09/05/2023 10:39, Fabien Chouteau wrote:
> The 2023 Stack Overflow survey is live: https://stackoverflow.blog/2023/05/08/the-2023-developer-survey-is-now-live/
> And for the first time Ada is listed in the options for "programming, scripting, and markup languages"!
>
> Don't hesitate to fill the survey and show that the Ada community is alive.
Done.
The 2023 Stack Overflow survey is live: https://stackoverflow.blog/2023/05/08/the-2023-developer-survey-is-now-live/ And for the first time Ada is listed in the options for "programming, scripting, and markup languages"! Don't hesitate to fill the survey and show that the Ada community is alive.
On 2023-05-09 10:36, Jeffrey R.Carter wrote: > This cost is due to the decision to allow access to elements using only > a cursor. If both the container and the cursor are needed, then the cost > is significantly reduced. That would be in the index/position team rather than in the cursor/pointer/address one. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
On 2023-05-09 05:56, Randy Brukardt wrote:
> It's not required to detect such cursors because it is expensive to do so
> perfectly (essentially, each cursor has to be controlled and one has to keep
> a list of them associated with the container). There are imperfect solutions
> which are likely to be "good enough" in practice, but they still have a
> (small) cost which may be an issue for some uses. Thus, most implementers
> don't use them. I know the original GNAT containers had a debugging version
> that included such checks, but I don't know if they still exist or how one
> would enable them if they do.
This cost is due to the decision to allow access to elements using only a
cursor. If both the container and the cursor are needed, then the cost is
significantly reduced. This is the approach that was used in the Ada-95 version
of the PragmAda Reusable Components.
--
Jeff Carter
“Bug rates in C++ are running higher even than C ...”
Stephen F. Zeigler
216
It's not required to detect such cursors because it is expensive to do so
perfectly (essentially, each cursor has to be controlled and one has to keep
a list of them associated with the container). There are imperfect solutions
which are likely to be "good enough" in practice, but they still have a
(small) cost which may be an issue for some uses. Thus, most implementers
don't use them. I know the original GNAT containers had a debugging version
that included such checks, but I don't know if they still exist or how one
would enable them if they do.
Randy.
"Mario Blunk" <mario.blunk.gplus@gmail.com> wrote in message
news:9a1c3ba5-d5ae-41d3-9eab-2b8cd941bc66n@googlegroups.com...
>> > How could I solve the problem ? Not using "rename" ? Using an aliased
>> > access type as John Barnes suggests in Ada2005 on page 275 ?
>> You have to avoid calling Element. Since you have a cursor, you can call
>> Query_Element, which should pass the actual element to the procedure you
>> supply.
>
> Right, that solves the problem. For those interested please find a
> comparison here:
>
> 1. The demo with a dangling (dangerous) cursor:
> https://github.com/Blunk-electronic/ada_training/blob/master/src/containers/demo/nested/nest_1.adb
>
> And the demo with the issue solved properly:
> https://github.com/Blunk-electronic/ada_training/blob/master/src/containers/demo/nested/nest_2.adb
>
> Still the question remains, why such a dangling cursor is not detected at
> runtime.
On Saturday, May 6, 2023 at 9:19:10 AM UTC-4, Ken Burtch wrote:
> On Saturday, May 6, 2023 at 9:08:47 AM UTC-4, 196...@googlemail.com wrote:
> > Can't be built without sound...
> >
> > gcc -c -O1 -march=athlon64 -gnat12 -gnatfaoN -gnatVaep -gnateEeEeF -fstack-protector -I./adacgi-1.6/ -I./apq-2.1/ -I./pegasock/ -I./areadline/ -lpcre parser_sound.adb
> > parser_sound.adb:93:06: statement expected
> > gnatmake: "parser_sound.adb" compilation error
> >
> >
> > If you try and build it without readline...
> >
> > gcc -c -O1 -march=athlon64 -gnat12 -gnatfaoN -gnatVaep -gnateEeEeF -fstack-protector -I./adacgi-1.6/ -I./pegasock/ pegasoft-user_io-getline.adb
> > pegasoft-user_io-getline.adb:286:26: "optional_bold" is undefined
> > gnatmake: "pegasoft-user_io-getline.adb" compilation error
> Thank you for sharing this issue.
>
> My automated release tests build SparForte without sound and without readline each night and they have been successful.
>
> I will attempt to diagnose what the problem is. Do you have any further information about your build environment that might be related to this issue?
>
> Ken B.
I have pushed fixes for these two issues to the GitHub master branch.
I will do a full set of build tests manually to ensure nothing else is missing.
I will also investigate what the errors were not caught by the automated tests.
Thank you for reporting this issue.
Ken B.
On Saturday, May 6, 2023 at 9:08:47 AM UTC-4, 196...@googlemail.com wrote:
> Can't be built without sound...
>
> gcc -c -O1 -march=athlon64 -gnat12 -gnatfaoN -gnatVaep -gnateEeEeF -fstack-protector -I./adacgi-1.6/ -I./apq-2.1/ -I./pegasock/ -I./areadline/ -lpcre parser_sound.adb
> parser_sound.adb:93:06: statement expected
> gnatmake: "parser_sound.adb" compilation error
>
>
> If you try and build it without readline...
>
> gcc -c -O1 -march=athlon64 -gnat12 -gnatfaoN -gnatVaep -gnateEeEeF -fstack-protector -I./adacgi-1.6/ -I./pegasock/ pegasoft-user_io-getline.adb
> pegasoft-user_io-getline.adb:286:26: "optional_bold" is undefined
> gnatmake: "pegasoft-user_io-getline.adb" compilation error
Thank you for sharing this issue.
My automated release tests build SparForte without sound and without readline each night and they have been successful.
I will attempt to diagnose what the problem is. Do you have any further information about your build environment that might be related to this issue?
Ken B.
On 2023-05-05 22:44, Simon Wright wrote:
> Manuel Gomez <mgrojo@gmail.com> writes:
>
>> El 5/5/23 a las 18:33, Simon Wright escribió:
>>> Manuel Gomez <mgrojo@gmail.com> writes:
>>>
>>>> Data : constant String := " PLUS_STRING :
>>>> CONSTANT STRING(1..3) :=(1 =>'""' , 2 =>'+' , 3 =>'""');";
>>> '"' is a single quote character.
>>> """" is a string containing one quote character.
>>
>> Yes, and "'""'" is a string containing a quote as an Ada character
>> (when displayed).
>
> Oh, I see. Ugh.
As you have discovered, using doubled quotation marks within a String literal
can be significantly less clear than concatenating the quotation-mark Character
with the rest of the String.
--
Jeff Carter
"All citizens will be required to change their underwear
every half hour. Underwear will be worn on the outside,
so we can check."
Bananas
29
Manuel Gomez <mgrojo@gmail.com> writes:
> El 5/5/23 a las 18:33, Simon Wright escribió:
>> Manuel Gomez <mgrojo@gmail.com> writes:
>>
>>> Or like this (doubling the quotes, which is the way to _escape_ the
>>> double quote inside Ada strings):
>>>
>>> Data : constant String := " PLUS_STRING :
>>> CONSTANT STRING(1..3) :=(1 =>'""' , 2 =>'+' , 3 =>'""');";
>> '"' is a single quote character.
>> """" is a string containing one quote character.
>
> Yes, and "'""'" is a string containing a quote as an Ada character
> (when displayed).
Oh, I see. Ugh.
Le 05/05/2023 à 20:18, Manuel Gomez a écrit : > Yes, and "'""'" is a string containing a quote as an Ada character (when > displayed). Even more fun (I use this for people who write a naive Ada parser): subtype C is Character; V : String := C'(')')'Img; -- J-P. Rosen Adalog 2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX https://www.adalog.fr https://www.adacontrol.fr
El 5/5/23 a las 18:33, Simon Wright escribió:
> Manuel Gomez <mgrojo@gmail.com> writes:
>
>> Or like this (doubling the quotes, which is the way to _escape_ the
>> double quote inside Ada strings):
>>
>> Data : constant String := " PLUS_STRING :
>> CONSTANT STRING(1..3) :=(1 =>'""' , 2 =>'+' , 3 =>'""');";
>
> '"' is a single quote character.
> """" is a string containing one quote character.
Yes, and "'""'" is a string containing a quote as an Ada character (when
displayed).
Manuel Gomez <mgrojo@gmail.com> writes:
> Or like this (doubling the quotes, which is the way to _escape_ the
> double quote inside Ada strings):
>
> Data : constant String := " PLUS_STRING :
> CONSTANT STRING(1..3) :=(1 =>'""' , 2 =>'+' , 3 =>'""');";
'"' is a single quote character.
"""" is a string containing one quote character.
El 5/5/23 a las 13:17, Jeffrey R.Carter escribió:
> On 2023-05-05 11:51, Daniel Gaudry wrote:
>> Data : constant String := " PLUS_STRING :
>> CONSTANT STRING(1..3) :=(1 =>'" & Double_Quote & "' , 2 =>'+' , 3 =>'"
>> & Double_Quote & ");";
>
> Wouldn't it be simpler and clearer to write this as
>
> Data : constant String := " PLUS_STRING : CONSTANT STRING := " & '"' &
> '+' & '"';
>
> ? Note also that you seem to be missing an apostrophe (''') before the
> right parenthesis if you intend Data to be a valid Ada declaration.
>
Or like this (doubling the quotes, which is the way to _escape_ the
double quote inside Ada strings):
Data : constant String := " PLUS_STRING :
CONSTANT STRING(1..3) :=(1 =>'""' , 2 =>'+' , 3 =>'""');";
On 2023-05-05 13:17, Jeffrey R.Carter wrote: > However, it's important to remember that 'Last is not necessarily the > same as 'Length because 'First is not necessarily one. This is > especially important in subprograms that take String parameters, as they > are often passed slices. Non-sliding indices is one of the most useful Ada features. You can pass indices around as-is, which is extremely helpful when processing strings. You will also find that actually 'Length and 'Last have different types, which is quite useful as well. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
On 2023-05-05 11:51, Daniel Gaudry wrote: > > Ada.Text_Io.Put_Line(" 05 10 15 20 25 30 35 40 45 50 55 65 70 75 80 85 90"); > Ada.Text_Io.Put_Line(" ....|....!....|....!....|....!....|....!....|....!....|....!....|....!....|....!....|....!"); > Ada.Text_Io.Put_Line("»" & Data & "« " & Data'Last'Img); As Kazakov pointed out, your scale is incorrect. However, it's important to remember that 'Last is not necessarily the same as 'Length because 'First is not necessarily one. This is especially important in subprograms that take String parameters, as they are often passed slices. Some questions: > Double_Quote : constant String(1 .. 1) := (others => '"' ); ARM 2.1(15/3) (http://www.ada-auth.org/standards/aarm12_w_tc1/html/AA-2-1.html#I1199) defines the name of '"' as "quotation mark". Why do you refer to a single quotation mark as Double_Quote? > Data : constant String := " PLUS_STRING : CONSTANT STRING(1..3) :=(1 =>'" & Double_Quote & "' , 2 =>'+' , 3 =>'" & Double_Quote & ");"; Wouldn't it be simpler and clearer to write this as Data : constant String := " PLUS_STRING : CONSTANT STRING := " & '"' & '+' & '"'; ? Note also that you seem to be missing an apostrophe (''') before the right parenthesis if you intend Data to be a valid Ada declaration. -- Jeff Carter "All citizens will be required to change their underwear every half hour. Underwear will be worn on the outside, so we can check." Bananas 29
On 2023-05-05 11:51, Daniel Gaudry wrote: > here is a code that i simplified > > with Ada.Text_Io; > procedure Help > is > Double_Quote : constant String(1 .. 1) := (others => '"' ); > Data : constant String := " PLUS_STRING : CONSTANT STRING(1..3) :=(1 =>'" & Double_Quote & "' , 2 =>'+' , 3 =>'" & Double_Quote & ");"; > begin > > Ada.Text_Io.Put_Line(" 05 10 15 20 25 30 35 40 45 50 55 65 70 75 80 85 90"); > Ada.Text_Io.Put_Line(" ....|....!....|....!....|....!....|....!....|....!....|....!....|....!....|....!....|....!"); > Ada.Text_Io.Put_Line("»" & Data & "« " & Data'Last'Img); > > end Help; > > but the data'last seems not to match the string size It matches. You missed the "60" tick in your scale. (:-)) -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
hi, here is a code that i simplified with Ada.Text_Io; procedure Help is Double_Quote : constant String(1 .. 1) := (others => '"' ); Data : constant String := " PLUS_STRING : CONSTANT STRING(1..3) :=(1 =>'" & Double_Quote & "' , 2 =>'+' , 3 =>'" & Double_Quote & ");"; begin Ada.Text_Io.Put_Line(" 05 10 15 20 25 30 35 40 45 50 55 65 70 75 80 85 90"); Ada.Text_Io.Put_Line(" ....|....!....|....!....|....!....|....!....|....!....|....!....|....!....|....!....|....!"); Ada.Text_Io.Put_Line("»" & Data & "« " & Data'Last'Img); end Help; but the data'last seems not to match the string size Any help is welcome best regards
This Ada library, providing Unicode character strings of dynamic length, is enriched by a third implementation: UXStrings3 [1] also available on Alire [2]. With this latter implementation, the characters are stored in Unicode form and the management of dynamic size uses the standard Wide_Wide_Unbounded strings library. Performance with Gnoga [3] is better. UXStrings2 already brought better performance in the case of strings only made up of ASCII characters (improvement by a factor 2 to 3 compared to UXStrings1). With UXStrings3 performance in the latter case is still improved (factor 6 to 7 compared to UXStrings1) moreover in the case of strings accentuated in French and strings containing emojis the process times are also improved (factor 7 to 8 by compared to UXStrings1 or even more in the case of emojis). For all cases, the global memory occupation of the Gnoga application is generally similar (9 to 10 Mb). The memory occupation due to UXStrings3 is negligible compared to the memory occupation of the server engine implemented in Gnoga. Study case: AdaEdit application using the Gnoga graphics library with UTF-8 files: English 315 kb French: 447 kb Emojis: 439 kb Process: read all lines of the given file and display the full text Regardless of the implementation chosen, the appealing of a library is mainly based on the capabilities it offers (API). So far in UXStrings, these are similar to those of the strings Ada standard libraries. If you find some missing, make your proposals on Github [4]. Pascal. [1] https://github.com/Blady-Com/UXStrings/blob/master/src/uxstrings3.ads [2] https://alire.ada.dev/crates/uxstrings.html [3] https://sourceforge.net/projects/gnoga [4] https://github.com/Blady-Com/UXStrings/issues
> I'm actually making something like this, but it isn't complete, and uses Lua scripts to handle different currencies (and formating). By the way, the code is here: https://sr.ht/~devin/Azurite-Ada/ Again, it's incomplete, and probably isn't exactly what you're looking for.
Em quinta-feira, 13 de abril de 2023 às 11:17:28 UTC-3, A.J. escreveu:
> Does anyone know if Ada has a currency library? Ideally one that includes the ISO 4217 currency standard?
>
> I've seen currency referenced as examples in the Style Guide[1] and other documentation[2] but I'm having trouble searching for anything concrete (and googling "ada" and "currency" has not helped due to some unfortunately named crypto stuff).
>
> I'm also interested in if there's any ada libraries for iso 3166 (country codes).
>
> If none of this exists, that's fine, it just gives me a reason to build it out myself, but I don't want duplication of effort :)
>
> AJ.
>
> [1] https://ada-lang.io/docs/style-guide/Reusability/#guideline-16
> [2] https://docs.adacore.com/live/wave/aunit/html/aunit_cb/aunit_cb/fixture.html
I'm actually making something like this, but it isn't complete, and uses Lua scripts to handle different currencies (and formating).
It also has location support (country, state, city) and language support, including message translation (so the program can output stuff in the user's language). For this, TOML is used.
It uses Glottolog codes to identify languages, and FIFA codes for the countries.
I paused the development because I'm focusing on another project that has been causing me some headaches lately.
It's broken and cannot deliver what you want - as of now.
суббота, 29 апреля 2023 г. в 19:35:50 UTC+3, Bill Findlay: > I guess I am wondering about this: >> Further additions and fixes for the Ada 2022 specification. > Where would AdaCore enumerate those updates? I can't speak for AdaCore, but I tried to search in ChangeLog and Regarding the improvement of Ada 2022 support, I only found two cases. The 'Index attribute has been implemented for use in the preconditions and postconditions of input families. Containers have received versions of cursor operations where the first argument is the container object. These include Has_Element, Element, Next, and so on, i.e. we can write My_Set.Has_Element (Cursor). https://forum.ada-lang.io/t/gcc-13-1-released/374/3?u=max
SparForte is a scripting language, template language and shell based on Ada and Bourne shell. It has been in development for 22 years and has about 129,000 lines of code. This release includes New features: 11 Changes: 7 Fixes: 12 New features include case procedures, named shell sessions, and Alire support (experimental). The details of the release are at https://sparforte.com/news/2023/news_may_2023.html A summary of the new features is at https://www.pegasoft.ca/coder/coder_march_2023.html SparForte can be downloaded from the home page at https://sparforte.com Ken O. Burtch
>> I have no problem buying it but I don't want a kiddle format.
>> Anyone knows of a pdf format somewhere ?
>
> AFAIK, it is only available for Kindle. You could try contacting
> Riehle directly.
I'd also be interested in a pdf or epub. I don't mind paying for the
file, but I don't use a Kindle and don't want to buy a download from
Amazon. It's not high priority for me so I'll just watch here in case
of updates.
On 29 Apr 2023, Simon Wright wrote (in article <ly8reaiv57.fsf@pushface.org>): > Bill Findlay<findlaybill@blueyonder.co.uk> writes: > > > Many thanks for the x86 macOS build of GNAT. > > Does it incorporate front-end updates since the Sep 30 build of > > gnat-12.2.0-1? > > It includes whatever changes Adacore & fellow maintainers have made! > From here<https://gcc.gnu.org/gcc-13/changes.html>, Thanks for that pointer. I guess I am wondering about this: > Further additions and fixes for the Ada 2022 specification. Where would AdaCore enumerate those updates? > This is on Darwin 21.6.0, with Command Line Tools 14.2, as reported by > $ pkgutil --pkg-info=com.apple.pkg.CLTools_Executables As usual, you immediately put your finger on the problem: out of date Command Line Tools (sigh). I have installed 14.3 and all is now well. Thanks again! -- Bill Findlay
Bill Findlay <findlaybill@blueyonder.co.uk> writes: > Many thanks for the x86 macOS build of GNAT. > Does it incorporate front-end updates since the Sep 30 build of > gnat-12.2.0-1? It includes whatever changes Adacore & fellow maintainers have made! From here <https://gcc.gnu.org/gcc-13/changes.html>, Ada Traceback support added in RTEMS for the PPC ELF and ARM architectures. Support for versions older than VxWorks 7 has been removed. General improvements to the contracts in the standard libraries. Addition of GNAT.Binary_Search. Further additions and fixes for the Ada 2022 specification. The Pragma SPARK_Mode=>Auto is now accepted. Contract analysis has been further improved. Documentation improvements. > Using the command: > >> gcc -c -I./ -I../Source -funwind-tables -gnatl12j96 -gnatw.e -gnatwD >> -gnatwH -gnatwP -gnatwT -gnatw.W -gnatw.B -gnatwC -gnatw.u -gnatyO >> -gnatw.Y -gnatw.N > -fdata-sections -ffunction-sections -gnatfn -mtune=native -Ofast > -fno-stack-check -fomit-frame-pointer -flto -I > /Users/wf/KDF9/emulation/Source/ee9.adb > > I got: > >> clang (LLVM option parsing): Unknown command line argument >> '-x86-pad-for-align=false'. Try: 'clang (LLVM option parsing) >> --help' >> clang (LLVM option parsing): Did you mean '--x86-slh-loads=false'? >> gnatmake: "/Users/wf/KDF9/emulation/Source/ee9.adb" compilation error gcc -c -I./ -I../Source -funwind-tables -gnatl12j96 -gnatw.e -gnatwD -gnatwH -gnatwP -gnatwT -gnatw.W -gnatw.B -gnatwC -gnatw.u -gnatyO -gnatw.Y -gnatw.N -fdata-sections -ffunction-sections -gnatfn -mtune=native -O3 -flto -I- /Users/simon/tmp/ee9/emulation/Source/ee9.adb worked without complaint. The command lines are different: I used V9p0p_for_Intel_macOS.zip, command mk9. This is on Darwin 21.6.0, with Command Line Tools 14.2, as reported by $ pkgutil --pkg-info=com.apple.pkg.CLTools_Executables
Hi Simon, Many thanks for the x86 macOS build of GNAT. Does it incorporate front-end updates since the Sep 30 build of gnat-12.2.0-1? > which gnat > /opt/gcc-13.1.0/bin/gnat Using the command: > gcc -c -I./ -I../Source -funwind-tables -gnatl12j96 -gnatw.e -gnatwD -gnatwH -gnatwP -gnatwT -gnatw.W -gnatw.B -gnatwC -gnatw.u -gnatyO -gnatw.Y -gnatw.N -fdata-sections -ffunction-sections -gnatfn -mtune=native -Ofast -fno-stack-check -fomit-frame-pointer -flto -I /Users/wf/KDF9/emulation/Source/ee9.adb I got: > clang (LLVM option parsing): Unknown command line argument '-x86-pad-for-align=false'. Try: 'clang (LLVM option parsing) --help' > clang (LLVM option parsing): Did you mean '--x86-slh-loads=false'? > gnatmake: "/Users/wf/KDF9/emulation/Source/ee9.adb" compilation error -- Bill Findlay
Thanks for swift answer. Seems like I have to live with the warning.
I learned about pragma restrictions(...); :-)
reinert
fredag 28. april 2023 kl. 09:26:20 UTC+2 skrev Simon Wright:
> reinert <rei...@gmail.com> writes:
>
> > ...../.config/alire/cache/dependencies/gnat_native_12.2.1_11f3b811/bin/../lib/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../x86_64-pc-linux-gnu/bin/ld:
> > warning: kobio0.o: requires executable stack (because the
> > .note.GNU-stack section is executable)
> Creating executable code on the stack is one way of getting malicious
> code past virus checkers. Modern OSs will prevent this approach.
>
> So far as I know, GNAT will only do this to implement "trampolines", but see
> here:
> https://docs.adacore.com/live/wave/gnat_rm/html/gnat_rm/gnat_rm/standard_and_implementation_defined_restrictions.html#no-implicit-dynamic-code
reinert <reinkor@gmail.com> writes: > ...../.config/alire/cache/dependencies/gnat_native_12.2.1_11f3b811/bin/../lib/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: > warning: kobio0.o: requires executable stack (because the > .note.GNU-stack section is executable) Creating executable code on the stack is one way of getting malicious code past virus checkers. Modern OSs will prevent this approach. So far as I know, GNAT will only do this to implement "trampolines", but see here: https://docs.adacore.com/live/wave/gnat_rm/html/gnat_rm/gnat_rm/standard_and_implementation_defined_restrictions.html#no-implicit-dynamic-code
Hello, I use alire and I just updated via these commands: alr index --update-all alr toolchain --select (selected gnat_native=12.2.1 and gprbuild=22.0.1 ) All seem OK, but when I use "alr build" I finally get this warning: ...../.config/alire/cache/dependencies/gnat_native_12.2.1_11f3b811/bin/../lib/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: warning: kobio0.o: requires executable stack (because the .note.GNU-stack section is executable) Build finished successfully in 19.48 seconds. When trying a simple "hello_world" programme, I do not get this annoying warning. Any hint? I do not like warnings which I do not understand anything from :-) reinert
I cannot build AWS. I have issued an issue #367 at GItHub. I got a respons on what to do. I just can't find out how. This is what has to be done: Use the standard build procedure which requires MSYS on Windows. Regards, Petter
Find this release, built on Intel but runs on Apple silicon under Rosetta, at https://github.com/simonjwright/distributing-gcc/releases/tag/gcc-13.1.0-x86_64 NB, previous builds were for macOS El Capitan or later, but that machine was elderly.
onsdag 26 april 2023 kl. 16:29:55 UTC+2 skrev Björn Lundin:
> On 2023-04-26 13:40, Petter wrote:
> >> b . f . lundin
> >> at
> >> gmail . com
> >>
> >> --
> >> /Björn
> > I'll do that if I can learn how to. Just responding to the mail I got with your post gave me this message
> >
> > Address not found
> > Your message wasn't delivered tocomp.lang.ada@googlegroups.com because the address couldn't be found, or is unable to receive mail.
>
> No. In order to avoid too much spam, I scrambled the mail address sligthly.
>
> 3 rows -> put them on the same row.
> remove all spaces.
>
> If i had written
>
> p . k . svensson
> at
> hotmail . com
>
> that would have been
> p.k.svensson@hotmail.com
>
>
>
>
> --
> /Björn
I could again not send email. This time I got :
Björn Lundin (<your emailaddress>) Det gick inte att leverera meddelandet på grund av ett kommunikationsfel. Försök att skicka meddelandet igen senare. Kontakta e-postadministratören om problemet kvarstår.
HE1EUR04FT035.mail.protection.outlook.com gav det här felet:
Requested action not taken: mailbox unavailable (S2017062302).
onsdag 26 april 2023 kl. 16:32:46 UTC+2 skrev Björn Lundin:
> On 2023-04-26 13:22, Petter wrote:
>
> > Yes. that platform. I'll file an issue. Iam learning more every hour.
> No. I meant Windows or Linux or mac
> > By the way, have our roads crossed earlier?
> > Regards,
> > Petter
> Don't know, just a first name makes it a bit hard to tell.
> I guess more than you are names 'Petter'
> But I cannot recall meeting anyone with that name since primary school
>
> --
> /Björn
My name is Petter Fryklund. I've been using Ada since 1991 as a consultant for Prono, Programator, Cap Programator, Cap Gemini, Sogeti, Atero and Sylog. I have been consulting at NobelTect, Saad Missiles, Sab Dynamics och Saab AeroTech. Now I'm an hobbiyist.
Last time I checked there was another Petter Fryklund but with an extra surname Borg. He is or was an actor in the Bert movies.
On 2023-04-26 13:22, Petter wrote: > Yes. that platform. I'll file an issue. Iam learning more every hour. No. I meant Windows or Linux or mac > By the way, have our roads crossed earlier? > Regards, > Petter Don't know, just a first name makes it a bit hard to tell. I guess more than you are names 'Petter' But I cannot recall meeting anyone with that name since primary school -- /Björn
On 2023-04-26 13:40, Petter wrote:
>> b . f . lundin
>> at
>> gmail . com
>>
>> --
>> /Björn
> I'll do that if I can learn how to. Just responding to the mail I got with your post gave me this message
>
> Address not found
> Your message wasn't delivered tocomp.lang.ada@googlegroups.com because the address couldn't be found, or is unable to receive mail.
No. In order to avoid too much spam, I scrambled the mail address sligthly.
3 rows -> put them on the same row.
remove all spaces.
If i had written
p . k . svensson
at
hotmail . com
that would have been
p.k.svensson@hotmail.com
--
/Björn
onsdag 26 april 2023 kl. 11:34:16 UTC+2 skrev Björn Lundin: > On 2023-04-26 01:40, Petter wrote: > > onsdag 26 april 2023 kl. 00:25:50 UTC+2 skrev Petter: > >> tisdag 25 april 2023 kl. 23:51:40 UTC+2 skrev Petter: > >>> How can I download AWS from github? I can't fine the correct command. > >> I've now made a little progress. I've been able to download. Folling the make instructions a get an erro on finding the tools for GNAT Pro,, which I don't have. Instead I tried to use the project file but then I get an error on not finding the > >> Environment Variable PRJ_TArget which I've no clue to set to what. > > I have managed to get a little further. I had to manually set the Environment Variable GNATDIR, but soon hit the next problem. > > tools.gpr:19:06: imported project file "../.build/projects/aws_lal" not found > > gprbuild: "tools/tools.gpr" processing failed > > Couldn't build or install AWS > > > What platform? > On https://github.com/AdaCore/aws > there is 'issues' > https://github.com/AdaCore/aws/issues > > where you can file an issue. > > -- > /Björn I've created an Issue: https://github.com/AdaCore/aws/issues/367
onsdag 26 april 2023 kl. 11:37:01 UTC+2 skrev Björn Lundin:
> On 2023-04-25 22:17, Petter wrote:
> > I'am developing an app for the swedish and european pools. In Sweden stryktipset. I'm very unsure about the vocabulary and as I intend to make my code available as open source I'd like to see a SWedish - English (Probaly Uk (:-)). I also have not received any advice on very to make it available. GitHub?
> >
> > My main concern now is tho decompress a mathematicall system to single rows (if that is the correct term.
> >
> > I'd love have a contact to share thoughts with.
> I've done a robot (system of robots actually) for Betfair.
> Contact me off list and we may have a discussion
> (I do speak Swedish)
>
> b . f . lundin
> at
> gmail . com
>
> --
> /Björn
I'll do that if I can learn how to. Just responding to the mail I got with your post gave me this message
Address not found
Your message wasn't delivered to comp.lang.ada@googlegroups.com because the address couldn't be found, or is unable to receive mail.
onsdag 26 april 2023 kl. 11:34:16 UTC+2 skrev Björn Lundin:
> On 2023-04-26 01:40, Petter wrote:
> > onsdag 26 april 2023 kl. 00:25:50 UTC+2 skrev Petter:
> >> tisdag 25 april 2023 kl. 23:51:40 UTC+2 skrev Petter:
> >>> How can I download AWS from github? I can't fine the correct command.
> >> I've now made a little progress. I've been able to download. Folling the make instructions a get an erro on finding the tools for GNAT Pro,, which I don't have. Instead I tried to use the project file but then I get an error on not finding the
> >> Environment Variable PRJ_TArget which I've no clue to set to what.
> > I have managed to get a little further. I had to manually set the Environment Variable GNATDIR, but soon hit the next problem.
> > tools.gpr:19:06: imported project file "../.build/projects/aws_lal" not found
> > gprbuild: "tools/tools.gpr" processing failed
> > Couldn't build or install AWS
> >
> What platform?
> On https://github.com/AdaCore/aws
> there is 'issues'
> https://github.com/AdaCore/aws/issues
>
> where you can file an issue.
>
> --
> /Björn
Yes. that platform. I'll file an issue. Iam learning more every hour.
By the way, have our roads crossed earlier?
Regards,
Petter
On 2023-04-25 22:17, Petter wrote:
> I'am developing an app for the swedish and european pools. In Sweden stryktipset. I'm very unsure about the vocabulary and as I intend to make my code available as open source I'd like to see a SWedish - English (Probaly Uk (:-)). I also have not received any advice on very to make it available. GitHub?
>
> My main concern now is tho decompress a mathematicall system to single rows (if that is the correct term.
>
> I'd love have a contact to share thoughts with.
I've done a robot (system of robots actually) for Betfair.
Contact me off list and we may have a discussion
(I do speak Swedish)
b . f . lundin
at
gmail . com
--
/Björn
On 2023-04-26 01:40, Petter wrote: > onsdag 26 april 2023 kl. 00:25:50 UTC+2 skrev Petter: >> tisdag 25 april 2023 kl. 23:51:40 UTC+2 skrev Petter: >>> How can I download AWS from github? I can't fine the correct command. >> I've now made a little progress. I've been able to download. Folling the make instructions a get an erro on finding the tools for GNAT Pro,, which I don't have. Instead I tried to use the project file but then I get an error on not finding the >> Environment Variable PRJ_TArget which I've no clue to set to what. > I have managed to get a little further. I had to manually set the Environment Variable GNATDIR, but soon hit the next problem. > tools.gpr:19:06: imported project file "../.build/projects/aws_lal" not found > gprbuild: "tools/tools.gpr" processing failed > Couldn't build or install AWS > What platform? On https://github.com/AdaCore/aws there is 'issues' https://github.com/AdaCore/aws/issues where you can file an issue. -- /Björn
onsdag 26 april 2023 kl. 00:25:50 UTC+2 skrev Petter:
> tisdag 25 april 2023 kl. 23:51:40 UTC+2 skrev Petter:
> > How can I download AWS from github? I can't fine the correct command.
> I've now made a little progress. I've been able to download. Folling the make instructions a get an erro on finding the tools for GNAT Pro,, which I don't have. Instead I tried to use the project file but then I get an error on not finding the
> Environment Variable PRJ_TArget which I've no clue to set to what.
I have managed to get a little further. I had to manually set the Environment Variable GNATDIR, but soon hit the next problem.
tools.gpr:19:06: imported project file "../.build/projects/aws_lal" not found
gprbuild: "tools/tools.gpr" processing failed
Couldn't build or install AWS
tisdag 25 april 2023 kl. 23:51:40 UTC+2 skrev Petter:
> How can I download AWS from github? I can't fine the correct command.
I've now made a little progress. I've been able to download. Folling the make instructions a get an erro on finding the tools for GNAT Pro,, which I don't have. Instead I tried to use the project file but then I get an error on not finding the
Environment Variable PRJ_TArget which I've no clue to set to what.
How can I download AWS from github? I can't fine the correct command.
I'am developing an app for the swedish and european pools. In Sweden stryktipset. I'm very unsure about the vocabulary and as I intend to make my code available as open source I'd like to see a SWedish - English (Probaly Uk (:-)). I also have not received any advice on very to make it available. GitHub? My main concern now is tho decompress a mathematicall system to single rows (if that is the correct term. I'd love have a contact to share thoughts with.
Niklas Holsti <niklas.holsti@tidorum.invalid> writes:
> It is not a fully automatic method, but you could write a null Ada
> procedure DebugBreak and set a breakpoint in that procedure, manually
> from gdb, before starting the program. Then every call to DebugBreak
> will break, and you can look one level down in the call chain to see
> the state at the point of call.
Great idea!
Petter <petter_fryklund@hotmail.com> writes: > I used some way to cause a DebugBreak() (programmatically causeng a > break command in gdb) some 10 years ago. Now I can't find it. Perhaps > one could raise int3? But I can't find how to either. I just googled debugbreak and the third hit was this: https://github.com/scottt/debugbreak It'd need some work, but at least on macOS/x86_64 GCC & clang[++] both give a SIGTRAP.
tisdag 25 april 2023 kl. 14:12:02 UTC+2 skrev Niklas Holsti:
> On 2023-04-25 14:18, Petter wrote:
> > I used some way to cause a DebugBreak() (programmatically causeng a
> > break command in gdb) some 10 years ago. Now I can't find it. Perhaps
> > one could raise int3? But I can't find how to either. Regards,
> > Petter
> What do you mean by "causing a break command in gdb"? Do you intend to
> run the program under gdb, and want to be able to insert something --
> perhaps a call DebugBreak -- in the Ada source to always cause a break
> into gdb control at the point of that call, without having to set gdb
> breakpoints at every call?
>
> It is not a fully automatic method, but you could write a null Ada
> procedure DebugBreak and set a breakpoint in that procedure, manually
> from gdb, before starting the program. Then every call to DebugBreak
> will break, and you can look one level down in the call chain to see the
> state at the point of call.
Sorry, I thougth DebugBreak() was familiar. If you in other languages not used by me call DebugBreak() i cuases the debugger to stop a running execution. I'm thought we had a similar for Ada. But I can be mistaken
On 2023-04-25 14:18, Petter wrote:
> I used some way to cause a DebugBreak() (programmatically causeng a
> break command in gdb) some 10 years ago. Now I can't find it. Perhaps
> one could raise int3? But I can't find how to either. Regards,
> Petter
What do you mean by "causing a break command in gdb"? Do you intend to
run the program under gdb, and want to be able to insert something --
perhaps a call DebugBreak -- in the Ada source to always cause a break
into gdb control at the point of that call, without having to set gdb
breakpoints at every call?
It is not a fully automatic method, but you could write a null Ada
procedure DebugBreak and set a breakpoint in that procedure, manually
from gdb, before starting the program. Then every call to DebugBreak
will break, and you can look one level down in the call chain to see the
state at the point of call.
I used some way to cause a DebugBreak() (programmatically causeng a break command in gdb) some 10 years ago. Now I can't find it. Perhaps one could raise int3? But I can't find how to either. Regards, Petter
> > How could I solve the problem ? Not using "rename" ? Using an aliased access type as John Barnes suggests in Ada2005 on page 275 ? > You have to avoid calling Element. Since you have a cursor, you can call > Query_Element, which should pass the actual element to the procedure you supply. Right, that solves the problem. For those interested please find a comparison here: 1. The demo with a dangling (dangerous) cursor: https://github.com/Blunk-electronic/ada_training/blob/master/src/containers/demo/nested/nest_1.adb And the demo with the issue solved properly: https://github.com/Blunk-electronic/ada_training/blob/master/src/containers/demo/nested/nest_2.adb Still the question remains, why such a dangling cursor is not detected at runtime.
Thank you all for your replies. This doesn't look easy so I guess I just leave it as is. Thanx again. Christoph
I have some code I'd like to share. To start with the calculation of Week number for System 2.
On 2023-04-23 12:48, AdaMagica wrote: >> The link in "You also may wish to visit this site devoted to the problem >> of dimensioned values in Ada." >> (http://www.christ-usch-grein.homepage.t-online.de/Ada/Dimension/SI.html) >> results in "Host not found". > > This can be found there: > https://www.adaic.org/ada-resources/tools-libraries/ see "Christoph Grein’s Essentials" > of more directly: > http://archive.adaic.com/tools/CKWG/Dimension/Dimension.html Thanks, I will fix the link. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
> The link in "You also may wish to visit this site devoted to the problem > of dimensioned values in Ada." > (http://www.christ-usch-grein.homepage.t-online.de/Ada/Dimension/SI.html) > results in "Host not found". This can be found there: https://www.adaic.org/ada-resources/tools-libraries/ see "Christoph Grein’s Essentials" of more directly: http://archive.adaic.com/tools/CKWG/Dimension/Dimension.html
"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes: > The library provides means for handling measurement units in Ada. > > http://www.dmitry-kazakov.de/ada/units.htm > > Changes to the previous version: > > - The package Generic_Complex_Measures was added to provide > dimensioned complex values; > - The package Complex_Measures added as an instance of > Generic_Complex_Measures with the type Float. Thanks for this. The link in "You also may wish to visit this site devoted to the problem of dimensioned values in Ada." (http://www.christ-usch-grein.homepage.t-online.de/Ada/Dimension/SI.html) results in "Host not found".
The current version provides implementations of smart pointers, directed graphs, sets, maps, B-trees, stacks, tables, string editing, unbounded arrays, expression analyzers, lock-free data structures, synchronization primitives (events, race condition free pulse events, arrays of events, reentrant mutexes, deadlock-free arrays of mutexes), pseudo-random non-repeating numbers, symmetric encoding and decoding, IEEE 754 representations support, streams, persistent storage, multiple connections server/client designing tools and protocols implementations. http://www.dmitry-kazakov.de/ada/components.htm Changes to the previous version: - The ambiguities in the ODBC.API package implementation fixed. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
The library provides means for handling measurement units in Ada. http://www.dmitry-kazakov.de/ada/units.htm Changes to the previous version: - The package Generic_Complex_Measures was added to provide dimensioned complex values; - The package Complex_Measures added as an instance of Generic_Complex_Measures with the type Float. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
On 2023-04-22 19:04, Mario Blunk wrote:
> I wonder why at runtime no exception is raised.
> How could I solve the problem ? Not using "rename" ? Using an aliased access type as John Barnes suggests in Ada2005 on page 275 ?
You have to avoid calling Element. Since you have a cursor, you can call
Query_Element, which should pass the actual element to the procedure you supply.
--
Jeff Carter
"He didn't get that nose from playing ping-pong."
Never Give a Sucker an Even Break
110
I wonder why at runtime no exception is raised. How could I solve the problem ? Not using "rename" ? Using an aliased access type as John Barnes suggests in Ada2005 on page 275 ?
I agree. If you used a debugging container that checked for dangling cursors, you probably would have gotten an exception from any use of the cursor to the dead copy. Not sure that would have been any clearer as to the cause, but it would be a suggestion. (Not sure if GNAT still has debugging containers, they did at one point, but a lot of work has been done on them since.) Randy. "Mario Blunk" <mario.blunk.gplus@gmail.com> wrote in message news:ed311a62-41ba-493e-a4cc-481402a1cc6bn@googlegroups.com... Thanks for your replies. Now it is becoming clear to me: 1. The statement net : type_net renames element (n) gives a copy of element (n). 2. After the assignment to "result" (line 55), "result" points to an element inside the local copy "net". 3. Once "net" is overwritten in the next call of query_net, "result" still refers to a "net" that does not exist anymore. Likewise, once procedure query_net is left, "result" still points to a list that does not exist anymore. Thatswhy I get garbage in line 68 and 77. Correct ?
On 2023-04-20 21:24, Gautier write-only address wrote:
>> G. de Montmollin has an Ada Excel writer, an Ada pkg for writing Excel files
>> (https://sourceforge.net/projects/excel-writer/). Presumably it could be
>> modified to read them.
>
> Actually, it is a completely different job. Note that it is the case for many formats (think of HTML or XML for instance).
"Modified" was a poor choice of words. "Used to figure out how" is more what I
had in mind.
--
Jeff Carter
"If change threatens you, you become conservative
in self-defense. If it thrills you, you become
liberal in self-liberation. ... [T]he Threateneds
are frequently more successful in the short run,
because they always fight dirty. But in the long
run, they always lose, because Thrilled people
learn and thus accomplish more."
Variable Star
220
On 2023-04-20 21:08, Gautier write-only address wrote:
> You can also forget to declare variables, with funny outcomes.
I set
option explicit
at the top of the module, which makes it complain if variable not decalared.
Or used to 25 years ago anyway.
option base 1
is good too, to make array index start at 1 instead of 0
VBA - long time ago - but some fond memories
--
/Björn
> G. de Montmollin has an Ada Excel writer, an Ada pkg for writing Excel files
> (https://sourceforge.net/projects/excel-writer/). Presumably it could be
> modified to read them.
Actually, it is a completely different job. Note that it is the case for many formats (think of HTML or XML for instance).
Now, you find in the Excel Writer toolbox a program called biff_dump.adb that supports some early Excel formats and could be extended.
For the current format(s) (.xlsx), you can combine Zip-Ada for the container and XML-Ada for the contents.
Same for the .ods format.
The simplest way by far is to generate the Ada sources from within Excel by using VBA (a BASIC with a strong Ada flavour, but still a BASIC) which is part of Excel. From Excel, you activate VBA with the Alt-F11 shortcut. You have "modules" which are just editor files and visible from everywhere else (you have like implicit "with"'s and "use"'s); you have functions called "Function" and procedures called "Sub". You can associate a button in the Excel sheet to a Sub. You declare each variable with "Dim x As Type". You can also forget to declare variables, with funny outcomes. The behavious of the type system around parameter passing is also funny. You find below a few examples. Now, if you already have your CSV-to-Ada generator, you can export a CSV; that's also easy with VBA. G. [somewhere (some module)] Sub Generate_for_Production() Dim anchor As String ' VBA String is Ada's Unbounded_String ' File handles Dim fh_ada_spec As Integer Dim fh_ada_body As Integer ... Open ThisWorkbook.Path & "\src\" & pkg_name & _ ".ads" For Output As #fh_ada_spec ... For Each ws In Worksheets ' Scan all worksheets For Each r In ws.UsedRange.Rows ' Scan all used rows anchor = r.Cells(1, 1).Value If anchor <> "" Then ... End If Next r Next ws ... Close #fh_ada_spec End Sub [somewhere else (perhaps another module)] Print #fh, "with Ada.Calendar;" Print #fh, "with Ada.Unchecked_Conversion;" Print #fh, "with Interfaces;" Print #fh, Print #fh, "package " & name & " is" [somewhere else] If simple_record Then Print #fh_ada_spec, " -- Simple record." Print #fh_ada_spec, Print #fh_ada_spec, " type Xyz is record -- " & paragraph Else Print #fh_ada_spec, " type Xyz is new " & parent_name & _ "Abc with record -- " & paragraph End If [somewhere else] For i = min_row_offset To max_row_offset ' Convert name in cell to Ada name field = Ada_Name(r.Cells(i, 3).Value) If field = "" Then Exit For End If amount = r.Cells(i, 6).Value ... Print #fh_ada_body, " for index in 1 .. " & amount & " loop" Print #fh_ada_body, " declare"
Thanks for your replies. Now it is becoming clear to me: 1. The statement net : type_net renames element (n) gives a copy of element (n). 2. After the assignment to "result" (line 55), "result" points to an element inside the local copy "net". 3. Once "net" is overwritten in the next call of query_net, "result" still refers to a "net" that does not exist anymore. Likewise, once procedure query_net is left, "result" still points to a list that does not exist anymore. Thatswhy I get garbage in line 68 and 77. Correct ?
Egil H H <ehh.public@gmail.com> writes: > Each call to `element(n)` returns a _copy_ of the element, which in > this case includes the enitre doubly linked list This is indeed the problem, thanks! I hadn't considered the effect of renaming a function call; the cursor constructed inside query_net refers to the locally renamed copy of type_net, which will be destroyed on exit from query_net. > (and since `net` is a > renames of `element(n), you would have gotten multiple copies if you > had called `net` multiple times inside query net) This appears to say that this renaming of a function call results in something like a macro, but I think that R : T renames Func; is more like R : constant T := Func; ARM 8.5(3) says "The elaboration of a renaming_declaration evaluates the name that follows the reserved word renames and thereby determines the view and entity denoted by this name (the renamed view and renamed entity). A name that denotes the renaming_declaration denotes (a new view of) the renamed entity."
On 2023-04-19 19:36, AdaMagica wrote: > I create Ada code from an Excel file. For this, I first manually export the file to csv format. The code generator works on the csv file. > I'd like to automate this first step by including the export into the code generator. > > I guess there is a C interface for Excel. I only just need the export functionality, not a full interface. > However, being illiterate in C, I'd further welcome help on the way to define an Ada interface to this C code. > > Can anyone help, please? Thanx a lot. AFAIK, Excel has an ODBC driver. So you can simply read/write an Excel table directly from Ada using ODBC SQL statements. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
On Thursday, April 20, 2023 at 7:15:36 AM UTC+2, Egil H H wrote:
> On Wednesday, April 19, 2023 at 9:09:48 AM UTC+2, Mario Blunk wrote:
>
> Using a reference instead should fix this problem:
> net : type_net renames nets.reference (key(n));
>
> or (Ada 2012):
> net : type_net renames nets(n);
>
oops, both my solutions are Ada 2012 :)
If Ada 2005 is a requirement (based on your explicit usage of `iterate`), I guess you would need an extra set of callbacks and call `update_element` in order to get a reference to the element containing the correct instance of the doubly linked list
--
~egilhh
On Wednesday, April 19, 2023 at 9:09:48 AM UTC+2, Mario Blunk wrote:
> Hello out there,
> I've put together a demo to reproduce a strange behavior of a cursor.
>
> https://github.com/Blunk-electronic/ada_training/blob/master/src/containers/demo/nested/nest_1.adb
>
Each call to `element(n)` returns a _copy_ of the element, which in this case includes the enitre doubly linked list
(and since `net` is a renames of `element(n), you would have gotten multiple copies if you had called `net` multiple times inside query net)
Using a reference instead should fix this problem:
net : type_net renames nets.reference (key(n));
or (Ada 2012):
net : type_net renames nets(n);
--
~egilhh
G. de Montmollin has an Ada Excel writer, an Ada pkg for writing Excel files (https://sourceforge.net/projects/excel-writer/). Presumably it could be modified to read them. -- Jeff Carter "I spun around, and there I was, face to face with a six-year-old kid. Well, I just threw my guns down and walked away. Little bastard shot me in the ass." Blazing Saddles 40
I create Ada code from an Excel file. For this, I first manually export the file to csv format. The code generator works on the csv file. I'd like to automate this first step by including the export into the code generator. I guess there is a C interface for Excel. I only just need the export functionality, not a full interface. However, being illiterate in C, I'd further welcome help on the way to define an Ada interface to this C code. Can anyone help, please? Thanx a lot. Christoph
Mario Blunk <mario.blunk.gplus@gmail.com> writes:
> I've put together a demo to reproduce a strange behavior of a cursor.
>
> https://github.com/Blunk-electronic/ada_training/blob/master/src/containers/demo/nested/nest_1.adb
>
> Description:
> Inside the procedure "get_line" the cursor "result" is assigned only
> once (on match). Since there is no further match, in the course of the
> procedure, I assume that "result" is never changed. So the expected
> output should be:
>
> net: A
> L1 S: 2.00000E+00 E: 3.00000E+00
> L2 S: 2.00000E+00 E: 3.00000E+00
> net: B
> L2 S: 2.00000E+00 E: 3.00000E+00
> L3 S: 2.00000E+00 E: 3.00000E+00
>
> but the actual output is:
>
> net: A
> L1 S: 2.00000E+00 E: 3.00000E+00
> L2 S: 2.00000E+00 E: 3.00000E+00
> net: B
> L2 S: 1.20000E+01 E: 1.30000E+01
> L3 S: 7.47956E-39 E: 0.00000E+00 -- changes randomly
This is a puzzler.
To simplify matters (for me, anyway) I changed your doubly linked list
to a vector. Now, instead of junk, I get an access violation.
'result' isn't changed, but a Cursor contains a pointer to the container
and an index; using gdb to look at the container via the unchanged
pointer, it's been overwritten with garbage. However, looping with this
(after the Nets.Iterate call, i.e. after Result has been damaged)
for N of Nets loop
for TL of N.Lines loop
Put_Line (To_String (TL));
end loop;
end loop;
works just fine.
My head hurts.
There is a demo program that reproduces a strange behavior. It could be related to the issue above. See: https://groups.google.com/g/comp.lang.ada/c/eOtyCu7dQ_c/m/3drS5DHuBQAJ
Hello out there, I've put together a demo to reproduce a strange behavior of a cursor. https://github.com/Blunk-electronic/ada_training/blob/master/src/containers/demo/nested/nest_1.adb Description: Inside the procedure "get_line" the cursor "result" is assigned only once (on match). Since there is no further match, in the course of the procedure, I assume that "result" is never changed. So the expected output should be: net: A L1 S: 2.00000E+00 E: 3.00000E+00 L2 S: 2.00000E+00 E: 3.00000E+00 net: B L2 S: 2.00000E+00 E: 3.00000E+00 L3 S: 2.00000E+00 E: 3.00000E+00 but the actual output is: net: A L1 S: 2.00000E+00 E: 3.00000E+00 L2 S: 2.00000E+00 E: 3.00000E+00 net: B L2 S: 1.20000E+01 E: 1.30000E+01 L3 S: 7.47956E-39 E: 0.00000E+00 -- changes randomly Thanks for your help.
Thanks for the advice. But I could not find an easy way to start using another newsreader. Also, since I'm now retired. I'm not prepared to spend any more money. I'd be grateful if someone addressed to problem in the OP: why do i have to hit F7 so many times? I also found out that I might not want to step into Ada.Containers.Vectors which is visited a lot of times for just a simple "for I of Vector". And more, something periodically triggers an abort_signal caught by ACV causing more F7s. (I semi-retired 2 years ago and fully last year from a career in consultancy. Some of you have seen my posts a few years ago, when I was at in order Nobel Tech, SAAB Ericsson Aerotronics, SAAB Dynamics. Randy might remember that I started my career at SAAB UNIVAC later to become UNISYS which Randy and friends created an ADA Compiler which I sadly never had a chance to try.)
On 17/04/2023 16:19, Simon Wright wrote:
> Niklas Holsti <niklas.holsti@tidorum.invalid> writes:
>
>> On 2023-04-17 17:20, Petter wrote:
>>> Also, is there a better way to create a post?
>>
>>
>> Hard to answer that, as you don't say which way you are using now.
>
> On this Mac, using Google Groups via Safari, there's a (+ New
> conversation) button at the top left.
>
> When I click on that, a window pops up with From at the top, Subject
> underneath, and then a large blank section for you to write your message
> in.
>
> In this case, a better subject would have been "Strange behaviour with GDB".
But hopefully a proper news reader wouldn't have duplicated the post ;)
--
Chris
Niklas Holsti <niklas.holsti@tidorum.invalid> writes:
> On 2023-04-17 17:20, Petter wrote:
>> Also, is there a better way to create a post?
>
>
> Hard to answer that, as you don't say which way you are using now.
On this Mac, using Google Groups via Safari, there's a (+ New
conversation) button at the top left.
When I click on that, a window pops up with From at the top, Subject
underneath, and then a large blank section for you to write your message
in.
In this case, a better subject would have been "Strange behaviour with GDB".
Niklas Holsti <niklas.holsti@tidorum.invalid> writes:
> On 2023-04-17 17:20, Petter wrote:
>> Also, is there a better way to create a post?
>
>
> Hard to answer that, as you don't say which way you are using now.
On this Mac, using Google Groups via Safari, there's a (+ New
conversation) button at the top left.
When I click on that, a window pops up with From at the top, Subject
underneath, and then a large blank section for you to write your message
in.
In this case, a better subject would have been "Strange behaviour with GDB".
On 2023-04-17 17:20, Petter wrote: > Also, is there a better way to create a post? Hard to answer that, as you don't say which way you are using now. It seems you are using Google Groups, which in general has a poor reputation for Usenet usability (this is a Usenet newsgroup, not an original Google Group). You could try to use a "real" newsreader (say, Thunderbird) and a Usenet server -- for example, see https://www.newsgroupreviews.com/eternal-september.html. And please don't write your (almost) entire message in the "Subject" :-)
I've found that locally naming arguments to procedures or functions s can also cause this problem.
Also, is there a better way to create a post? Regards, Petter
On 2023-04-15 20:52, A.J. wrote:
> I just created a library for accessing ISO 3166-1 records in Ada compatible with Ada.Locales. Before I try to publish it to Alire, I'm hoping to get some feedback if anyone has some. It's possible that feedback will result in the function calls, naming convention, or structure being set up differently, so please let me know what you think.
>
> https://github.com/AJ-Ianozi/iso_3166
Some initial thoughts on what you have:
It seems likely that your clients will use the alpha codes for input and
display. It will be more convenient for that if the alpha codes are subtypes of
String rather than distinct types.
Since you have already enumerated all 250 possible alpha codes, your predicates
could look like
subtype Alpha_Code_2 is String (1 .. 2) with
Dynamic_Predicate => Alpha_Code_2 in "AF" | "AL" | ...;
and similar for the 3-letter codes.
Since you have already enumerated all 250 possible numeric codes, you could use
a restricted range for your numeric (sub)type, with a predicate restricting it
to valid values.
These use the language to do validity checking for you.
Regarding the design of such a pkg, my initial instinct was to use enumeration
types for the alpha codes, but a little investigation shows that some of the
codes are Ada reserved words, so that doesn't work. So I would stick with the
String subtypes and provide functions such that, given one of the values, the
client can obtain the others, as well as the name. Alternatively, one could have
functions to return a record such as you provide. Which is preferable depends on
how such a pkg is typically used.
There are various possible implementations, with different tradeoffs.
--
Jeff Carter
"He nevere yet no vileynye ne sayde
In al his lyf unto no maner wight."
Canterbury Tales
156
I just created a library for accessing ISO 3166-1 records in Ada compatible with Ada.Locales. Before I try to publish it to Alire, I'm hoping to get some feedback if anyone has some. It's possible that feedback will result in the function calls, naming convention, or structure being set up differently, so please let me know what you think. https://github.com/AJ-Ianozi/iso_3166 I also posted this on the subreddit, so apologies for any redundancy for those viewing both!
On Sunday, 9 April 2023 at 08:01:50 UTC+1, Leonid Dulman wrote:
> On Saturday, April 8, 2023 at 5:07:12 PM UTC+3, 196...@googlemail.com wrote:
> > On Monday, 3 April 2023 at 05:12:08 UTC+1, Leonid Dulman wrote:
> > > It based on Qt-6.5.0-everywhere opensource (expanded with modules from Qt-5.15: qtgamepad, qtx11extras,qtwinextras),VTK-9.2.0,FFMPEG-5.2.1,OpenCV-4.7.0,SDL2-2.24.0,QtAV-1.13 MDK-SDK(wang-bin)
> > > Qt6ada version 6.5.0 open source and qt6base.dll ,qt6ext.dll (win64),libqt6base.so,libqt6txt.so(x86-64) built with Microsoft Visual Studio 2023 x64 Windows, gcc amd64 in Linux.
> > > Package tested with gnat gpl 2020 ada compiler in Windows 64bit , Linux amd64 Debian 11.2
> > [...]
> > > The full list of released classes is in "Qt6 classes to Qt6Ada packages relation table.pdf"
> > > The simple manual how to build Qt6Ada application can be read in "How to use Qt6ada.pdf"
> > > If you have any problems or questions, tell me know.
> > > Leonid(leonid...@gmail.com)
> > Sigh....
> >
> > The supplied pdf says to build do:
> > 2. Inside qtada directory to do : gc *.ads and gc *.adb or compile_all script
> >
> > Well, gc is count graph components, but perhaps you meant gcc. Regardless, that does not build shared libs.
> >
> > There is also no compile_all script.
> >
> > Great that you have done this, but I think some would be more appreciative if the build instructions were even remotely correct.
> gc.bat is ascript
> gcc -gnat2020 -gnatwA -c %1
A. That does not work on unix systems.
B. That does not create a library.
I raised this in the ada-lang gitter channel and it was suggested that this is likely a bug, but figured I'd post here before raising a bug report just in case. The following example program gives me a compile error with x86-64 gnat 12.2 (can also be seen at https://ada.godbolt.org/z/45G1x9sEd) example.adb:70:05: error: instantiation error at line 67 example.adb:70:05: error: "P_Formal_Type" is not a visible entity of "P_Instance" ----- procedure Example is generic type E_Formal_Type is abstract tagged private; package E is end; type E_Actual_Type is tagged null record; package E_Instance is new E (E_Actual_Type); generic with package E_Formal_Pkg is new E (<>); type D_Formal_Type is new E_Formal_Pkg.E_Formal_Type with private; package D is end; type D_Actual_Type is new E_Actual_Type with null record; package D_Instance is new D (E_Instance, D_Actual_Type); generic with package E_Formal_Pkg is new E (<>); with package D_Formal_Pkg is new D (E_Formal_Pkg => E_Formal_Pkg, others => <>); type P_Formal_Type is new E_Formal_Pkg.E_Formal_Type with private; package P is end; type P_Actual_Type is new E_Actual_Type with null record; package P_Instance is new P (E_Instance, D_Instance, P_Actual_Type); generic with package E_Formal_Pkg is new E (<>); with package D_Formal_Pkg is new D (E_Formal_Pkg => E_Formal_Pkg, others => <>); with package P_Formal_Pkg is new P (E_Formal_Pkg => E_Formal_Pkg, D_Formal_Pkg => D_Formal_Pkg, others => <>); package Test is type Test_Type is new P_Formal_Pkg.P_Formal_Type with null record; -- Line 67 end Test; package Test_Instance is -- Line 70 new Test (E_Instance, D_Instance, P_Instance); begin null; end Example; --- Per ARM 12.7.10/2 I believe that should be legal? A slight modification as can be seen at https://ada.godbolt.org/z/4x4h4s7f5 compiles successfully.
J-P. Rosen, On Thursday, April 13, 2023 at 1:37:22 PM UTC-4, J-P. Rosen wrote: > It's a standard package, Ada.Locales Thanks for finding that! This looks like a good foundation for validating county codes, though it doesn't appear to contain an index of them, or expand into the 3-letter codes (e.g. USA vs US). I was looking into the implementation, and the GNAT[1] runtime seems to be true to spec, while the Drake runtime[2] looks like it's expanding into closer to what I'm looking for with its iso639 tables [3]. I may be able to build on this set, though and use the existing structures. AJ [1] https://github.com/gcc-mirror/gcc/blob/master/gcc/ada/libgnat/a-locale.ads & https://github.com/gcc-mirror/gcc/blob/master/gcc/ada/libgnat/a-locale.adb [2] https://github.com/ytomino/drake/blob/master/source/environment/a-locale.ads [3] https://github.com/ytomino/drake/blob/master/source/environment/a-locale.adb#L60
Le 13/04/2023 à 16:17, A.J. a écrit : > I'm also interested in if there's any ada libraries for iso 3166 (country codes). It's a standard package, Ada.Locales -- J-P. Rosen Adalog 2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX https://www.adalog.fr https://www.adacontrol.fr
Does anyone know if Ada has a currency library? Ideally one that includes the ISO 4217 currency standard? I've seen currency referenced as examples in the Style Guide[1] and other documentation[2] but I'm having trouble searching for anything concrete (and googling "ada" and "currency" has not helped due to some unfortunately named crypto stuff). I'm also interested in if there's any ada libraries for iso 3166 (country codes). If none of this exists, that's fine, it just gives me a reason to build it out myself, but I don't want duplication of effort :) AJ. [1] https://ada-lang.io/docs/style-guide/Reusability/#guideline-16 [2] https://docs.adacore.com/live/wave/aunit/html/aunit_cb/aunit_cb/fixture.html
On 2023-04-12 04:18, Spiros Bousbouras wrote: > On Tue, 11 Apr 2023 14:03:27 +0200 > "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote: >> The formal meaning of weaker/stronger relation on predicates P and Q: >> >> weaker P => Q >> stronger Q => P >> >> The formal rationale is that if you have a proof >> >> P1 => P2 => P3 >> >> Then weakening P1 to P1' => P1 and strengthening P3 => P3' keeps it: >> >> P1' => P2 => P3' > > You have it backwards ; if P1' implies P1 then P1' is stronger > than P1 . Yes, you are right. Inclusion is an inverse of implication. A weaker predicate is true on a set that contains the set where the stronger predicate is. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
Spiros Bousbouras <spibou@gmail.com> writes:
> On Wed, 12 Apr 2023 02:18:45 -0000 (UTC)
> Spiros Bousbouras <spibou@gmail.com> wrote:
>> On Tue, 11 Apr 2023 14:03:27 +0200
>> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote:
>> > The formal meaning of weaker/stronger relation on predicates P and Q:
>> >
>> > weaker P => Q
>> > stronger Q => P
>> >
>> > The formal rationale is that if you have a proof
>> >
>> > P1 => P2 => P3
>> >
>> > Then weakening P1 to P1' => P1 and strengthening P3 => P3' keeps it:
>> >
>> > P1' => P2 => P3'
>>
>> You have it backwards ; if P1' implies P1 then P1' is stronger
>> than P1 .
>
> Apologies ; it was me who got it backwards.
No, you are correct. If P1' => P1 then P1' /is/ stronger (or at least
no weaker) than P1.
Using upper and lower case to suggest stronger and weaker then if we
have a proof p |- Q, then we can also assert that P |- q for all
stronger premises P and weaker conclusions q. Formally
{p, P=>p, Q=>q} |- q
Or, written out using the deduction theorem, if we have p=>Q then we can
assert P=>q for any stronger P (so P=>p) and any weaker q (so Q=>q).
In Floyd-Hoare logic, this is embodied in the consequence rule:
P=>p, {p}S{Q}, Q=>q
-------------------
{P}S{q}
which says that we can always strengthen a pre-condition and weaken a
post-condition.
However (if I've got the context right), in terms of substitution and/or
inheritance, Dmitry-Kazakov was correct to say that "The general
principle of substitutability is that the preconditions can be weakened,
the postoconditions can be strengthened". It's just the definition that
was backwards.
--
Ben.
On 12.04.23 05:37, Spiros Bousbouras wrote:
> On Wed, 12 Apr 2023 02:18:45 -0000 (UTC)
> Spiros Bousbouras <spibou@gmail.com> wrote:
>> On Tue, 11 Apr 2023 14:03:27 +0200
>> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote:
>>> The formal meaning of weaker/stronger relation on predicates P and Q:
>>>
>>> weaker P => Q
>>> stronger Q => P
>>>
>>> The formal rationale is that if you have a proof
>>>
>>> P1 => P2 => P3
>>>
>>> Then weakening P1 to P1' => P1 and strengthening P3 => P3' keeps it:
>>>
>>> P1' => P2 => P3'
>>
>> You have it backwards ; if P1' implies P1 then P1' is stronger
>> than P1 .
>
> Apologies ; it was me who got it backwards.
Thanks for pointing out the issue: When P_n or Q_m don't
mention the thing to which they "belong",
then how does just mentioning names of predicates clarify
to what end of the substitution the comparatives "weaker"
or "stronger" will apply? It's variance of meaning.
"The LSP paper" uses "weak" more generally.
OK, condition P is generally considered stronger than Q
if P implies Q, right? I.e., Q not without P.
Is there a commonly accepted definition of the words "weak"
and "strong", in mathematics perhaps, that justifies the
usual contextual _omissions_ from speech?
LSP uses "pre" and "post" for an object's value in a state.
There are phrases such as "stronger requirements that constrain".
Consider a different choice of adjectives:
Given a primitive operation f of a type T,
then a precondition of any overridden f of
a type D descended from T must be sexier.
Does "sexy" carry more or less meaning than "weak" WRT assertions?
On 2023-04-12 6:37, Spiros Bousbouras wrote:
> On Wed, 12 Apr 2023 02:18:45 -0000 (UTC)
> Spiros Bousbouras <spibou@gmail.com> wrote:
>> On Tue, 11 Apr 2023 14:03:27 +0200
>> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote:
>>> The formal meaning of weaker/stronger relation on predicates P and Q:
>>>
>>> weaker P => Q
>>> stronger Q => P
>>>
>>> The formal rationale is that if you have a proof
>>>
>>> P1 => P2 => P3
>>>
>>> Then weakening P1 to P1' => P1 and strengthening P3 => P3' keeps it:
>>>
>>> P1' => P2 => P3'
>>
>> You have it backwards ; if P1' implies P1 then P1' is stronger
>> than P1 .
>
> Apologies ; it was me who got it backwards.
Speaking of logic in general, rather than Ada contracts in particular, I
would say that you got it right, and Dmitry did not.
Suppose we have a theorem about geometrical figures F, and at first we
can prove the theorem only if we assume (precondition) that the figure F
is a square. Later we manage to improve the proof so that it holds also
for rectangles. I would say, and I think mathematicians would say, that
we /weakened/ the assumptions from "F is a square" to "F is a
rectangle", and indeed the former (stronger) implies the latter
(weaker), which is not as Dmitry defined "stronger".
On Wed, 12 Apr 2023 02:18:45 -0000 (UTC)
Spiros Bousbouras <spibou@gmail.com> wrote:
> On Tue, 11 Apr 2023 14:03:27 +0200
> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote:
> > The formal meaning of weaker/stronger relation on predicates P and Q:
> >
> > weaker P => Q
> > stronger Q => P
> >
> > The formal rationale is that if you have a proof
> >
> > P1 => P2 => P3
> >
> > Then weakening P1 to P1' => P1 and strengthening P3 => P3' keeps it:
> >
> > P1' => P2 => P3'
>
> You have it backwards ; if P1' implies P1 then P1' is stronger
> than P1 .
Apologies ; it was me who got it backwards.
On Tue, 11 Apr 2023 14:03:27 +0200
"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote:
> The formal meaning of weaker/stronger relation on predicates P and Q:
>
> weaker P => Q
> stronger Q => P
>
> The formal rationale is that if you have a proof
>
> P1 => P2 => P3
>
> Then weakening P1 to P1' => P1 and strengthening P3 => P3' keeps it:
>
> P1' => P2 => P3'
You have it backwards ; if P1' implies P1 then P1' is stronger
than P1 .
On 2023-04-11 07:56, G.B. wrote: > On 08.04.23 10:02, Dmitry A. Kazakov wrote: >> On 2023-04-08 09:00, mockturtle wrote: >> >>> Should the actual subprogram specify the same contract? I am not sure >>> (and I guess this could be a stumbling block for the adoption of this >>> idea). >> >> The general principle of substitutability is that the preconditions >> can be weakened, the postoconditions can be strengthened. > > Side track: "weak" and "strong" alone sounding like a valuation to the > uninitiated, but neither technical nor precise; and the "objects" of > comparison of sets of conditions being implicit; and the ARM not > defining a technical term for these adjectives unless weak ordering > helps. The formal meaning of weaker/stronger relation on predicates P and Q: weaker P => Q stronger Q => P The formal rationale is that if you have a proof P1 => P2 => P3 Then weakening P1 to P1' => P1 and strengthening P3 => P3' keeps it: P1' => P2 => P3' -------------------------------------------------------- As for ARM. Regarding dynamic checks all the above is irrelevant because dynamic checks are no contracts. Furthermore since the proper contracts include Constraint_Error or Storage_Error raised, do you really care how are you going to bomb your program while keeping proper contracts? (:-)) Sincere advise: forget about this mess. For static checks a proof of implication is rather straightforward since we assume that all static predicates must be decidable anyway. Of course, with generics you might run into troubles as you would have both proper contracts, i.e. the instantiated ones, and the generic ones expressed in generic terms. Instantiated contracts are easy to check, but what one would actually wish is checking generic contracts, which might turn impossible. The glimpse of the problem is what any Ada programmer knows: generic instantiations may fail to compile even if the actual parameters match... -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
On 08.04.23 10:02, Dmitry A. Kazakov wrote:
> On 2023-04-08 09:00, mockturtle wrote:
>
>> Should the actual subprogram specify the same contract? I am not sure (and I guess this could be a stumbling block for the adoption of this idea).
>
> The general principle of substitutability is that the preconditions can be weakened, the postoconditions can be strengthened.
Side track: "weak" and "strong" alone sounding like a valuation to the
uninitiated, but neither technical nor precise; and the "objects" of
comparison of sets of conditions being implicit; and the ARM not
defining a technical term for these adjectives unless weak ordering
helps.
If these adjectives induce confusion, can they be avoided? E.g., by
instead mentioning the sets of Pre- and Post-conditions of those
actual/formal/overriding subprograms. I guess that super- and subset
relations will permit helpfully defining an ordering to be understood
(in general, if not in the ARM).
Dear Ada Community VisualAda version 1.0.0.12 for Visual Studio 2022 has been released Enhancements include the following - Bug fixes in Intellisense (Statement completion) Please feel free to download the free plugin from the following URL https://marketplace.visualstudio.com/items?itemName=AlexGamper.VisualAda-2022 Thanks Alex
On Saturday, April 8, 2023 at 5:07:12 PM UTC+3, 196...@googlemail.com wrote:
> On Monday, 3 April 2023 at 05:12:08 UTC+1, Leonid Dulman wrote:
> > It based on Qt-6.5.0-everywhere opensource (expanded with modules from Qt-5.15: qtgamepad, qtx11extras,qtwinextras),VTK-9.2.0,FFMPEG-5.2.1,OpenCV-4.7.0,SDL2-2.24.0,QtAV-1.13 MDK-SDK(wang-bin)
> > Qt6ada version 6.5.0 open source and qt6base.dll ,qt6ext.dll (win64),libqt6base.so,libqt6txt.so(x86-64) built with Microsoft Visual Studio 2023 x64 Windows, gcc amd64 in Linux.
> > Package tested with gnat gpl 2020 ada compiler in Windows 64bit , Linux amd64 Debian 11.2
> [...]
> > The full list of released classes is in "Qt6 classes to Qt6Ada packages relation table.pdf"
> > The simple manual how to build Qt6Ada application can be read in "How to use Qt6ada.pdf"
> > If you have any problems or questions, tell me know.
> > Leonid(leonid...@gmail.com)
> Sigh....
>
> The supplied pdf says to build do:
> 2. Inside qtada directory to do : gc *.ads and gc *.adb or compile_all script
>
> Well, gc is count graph components, but perhaps you meant gcc. Regardless, that does not build shared libs.
>
> There is also no compile_all script.
>
> Great that you have done this, but I think some would be more appreciative if the build instructions were even remotely correct.
gc.bat is ascript
gcc -gnat2020 -gnatwA -c %1
On Saturday, April 8, 2023 at 6:48:14 PM UTC+2, Simon Wright wrote:
> GCC 12.2.0 accepts this code with -gnat2022.
True! Cool... In my opinion, contracts are among the coolest (and maybe more exclusive) features of Ada
GCC 12.2.0 accepts this code with -gnat2022.
On Monday, 3 April 2023 at 05:12:08 UTC+1, Leonid Dulman wrote: > It based on Qt-6.5.0-everywhere opensource (expanded with modules from Qt-5.15: qtgamepad, qtx11extras,qtwinextras),VTK-9.2.0,FFMPEG-5.2.1,OpenCV-4.7.0,SDL2-2.24.0,QtAV-1.13 MDK-SDK(wang-bin) > Qt6ada version 6.5.0 open source and qt6base.dll ,qt6ext.dll (win64),libqt6base.so,libqt6txt.so(x86-64) built with Microsoft Visual Studio 2023 x64 Windows, gcc amd64 in Linux. > Package tested with gnat gpl 2020 ada compiler in Windows 64bit , Linux amd64 Debian 11.2 [...] > The full list of released classes is in "Qt6 classes to Qt6Ada packages relation table.pdf" > The simple manual how to build Qt6Ada application can be read in "How to use Qt6ada.pdf" > If you have any problems or questions, tell me know. > Leonid(leonid...@gmail.com) Sigh.... The supplied pdf says to build do: 2. Inside qtada directory to do : gc *.ads and gc *.adb or compile_all script Well, gc is count graph components, but perhaps you meant gcc. Regardless, that does not build shared libs. There is also no compile_all script. Great that you have done this, but I think some would be more appreciative if the build instructions were even remotely correct.
Ada 2022 allows such contracts; Ada 2012 did not. (See 6.1.1, and specifically 6.1.1(1/5)). Whether your compiler has caught up, who knows. Logically the contracts should "match" (with the weakening/strengthing that Dmitry mentioned), but that was too hard for Ada, so they're just additive. (A proper matching mechanism is more the sort of thing that SPARK does, Ada only enforces these contracts at runtime) That is, when you call through a generic formal subprogram, you enforce the preconditions of both the formal and the actual subprogram, and similarly for the postconditions. If they mismatch, you might not be able to make a successful call. If it hurts, don't do that. ;-) Randy. "mockturtle" <framefritti@gmail.com> wrote in message news:0c555ce7-0b2e-49f1-8930-c4f4796793e4n@googlegroups.com... Dear.all, this is something that looked like a natural and nice idea to me, but the compiler disagree :-): specifying contracts in formal subprograms in generic declarations. Actually, RM 12.6 does not prohibit this on a syntactic level (a aspect_specification part is included), but the compiler complains. To understand what I mean, please check the following real code toy-zed (can you hear the grammar screaming?) ----------------------- generic type Ring is private; with function Divides (Num, Den : Ring) return Boolean; with function Is_Invertible (X : Ring) return Boolean; with function Inv (X : Ring) return Ring with Pre => Is_Invertible (X); with function Gcd (X, Y : Ring) return Ring with Post => Divides (X, Gcd'Result) and Divides (Y, Gcd'Result); package Pippo is -- stuff end Pippo; ---------------------------------- The meaning I have in mind is something like * For "Pre" aspect: who writes function Inv can assume that X is invertible since Inv will never be called (by the package code, at least) with X not invertible. Also Inv cannot have a stricter pre-condition. In a sense, the package expects Inv to work correctly if and only if the pre-condition is true. * For "Post" aspect: I expect that the result of GCD satisfies the post condition. Post conditions for the actual subprogram can be stricter, as long as the post condition of the formal parameter is satisfied. For example, if Ring is Integer, GCD could always return a positive value that divides both X and Y. The fact that the result is positive does not hurt. Should the actual subprogram specify the same contract? I am not sure (and I guess this could be a stumbling block for the adoption of this idea). One could say that the actual subprogram gets a contract that is the AND of the actual subprogram and the contract specified in the generic declaration, it is up to the programmer to check that they are compatible. I guess the compatibility could be verified by the compiler itself in simple cases, but I expect that this could not be feasible in some cases (maybe of academic interest?). Riccardo
I agree with the other answers (for the most part). Not much is guarenteed
about 'Address. But by-reference and aliased objects have to *work* like
they are not moved. If the runtime can deal with moving such things, Ada
doesn't care.
As a practical matter, most Ada implementations assume objects don't move.
Janus/Ada assigns everything at compile-time, so the only time anything
moves is when it is created or destroyed.
The big problem with garbage collection in Ada is that early finalization is
not allowed (other than a few tiny exceptions in failure cases and [in
post-Ada 22] certain function results.) So any object that might have a
controlled part can never be garbage collected, even if there is no other
use or access to it.
Changing that is a very hard problem, as you cannot allow finalization to
happen at any instant or by any arbitrary task (if you did, every
finalization would be a race scenario, and every Finalize routine would need
dedicated locking). I've suggesting allowing it for "unreachable objects"
(not a useful definition by itself, it would need to be defined) at places
where masters are being exited anyway (so finalization should be expected at
those locations). But it's unclear if you can build a useful garbage
collector that way (and what the overhead would be).
Randy.
"Niklas Holsti" <niklas.holsti@tidorum.invalid> wrote in message
news:k94t2nFelgbU1@mid.individual.net...
>A discussion in comp.arch (on the new C23 standard for C) brought up these
>questions, which I could not answer with confidence:
>
> - Is the address of an object constant in Ada? That is, if I have some
> object X in an Ada program, do repeated applications of X'Address always
> return the same value?
>
> - Does the answer depend on how X is allocated (created): on the library
> level, on the stack, or in a pool ("new")?
>
> The issue behind this question is whether an Ada program could use garbage
> collection that moves objects around, for example a compacting collector.
On 2023-04-08 09:00, mockturtle wrote: > Should the actual subprogram specify the same contract? I am not sure (and I guess this could be a stumbling block for the adoption of this idea). The general principle of substitutability is that the preconditions can be weakened, the postoconditions can be strengthened. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
Dear.all, this is something that looked like a natural and nice idea to me, but the compiler disagree :-): specifying contracts in formal subprograms in generic declarations. Actually, RM 12.6 does not prohibit this on a syntactic level (a aspect_specification part is included), but the compiler complains. To understand what I mean, please check the following real code toy-zed (can you hear the grammar screaming?) ----------------------- generic type Ring is private; with function Divides (Num, Den : Ring) return Boolean; with function Is_Invertible (X : Ring) return Boolean; with function Inv (X : Ring) return Ring with Pre => Is_Invertible (X); with function Gcd (X, Y : Ring) return Ring with Post => Divides (X, Gcd'Result) and Divides (Y, Gcd'Result); package Pippo is -- stuff end Pippo; ---------------------------------- The meaning I have in mind is something like * For "Pre" aspect: who writes function Inv can assume that X is invertible since Inv will never be called (by the package code, at least) with X not invertible. Also Inv cannot have a stricter pre-condition. In a sense, the package expects Inv to work correctly if and only if the pre-condition is true. * For "Post" aspect: I expect that the result of GCD satisfies the post condition. Post conditions for the actual subprogram can be stricter, as long as the post condition of the formal parameter is satisfied. For example, if Ring is Integer, GCD could always return a positive value that divides both X and Y. The fact that the result is positive does not hurt. Should the actual subprogram specify the same contract? I am not sure (and I guess this could be a stumbling block for the adoption of this idea). One could say that the actual subprogram gets a contract that is the AND of the actual subprogram and the contract specified in the generic declaration, it is up to the programmer to check that they are compatible. I guess the compatibility could be verified by the compiler itself in simple cases, but I expect that this could not be feasible in some cases (maybe of academic interest?). Riccardo
On 2023-04-05 11:24, Niklas Holsti wrote: > > - Is the address of an object constant in Ada? That is, if I have some object X > in an Ada program, do repeated applications of X'Address always return the same > value? > > - Does the answer depend on how X is allocated (created): on the library level, > on the stack, or in a pool ("new")? 'Address is discussed in ARM 13.3 (http://www.ada-auth.org/standards/aarm12_w_tc1/html/AA-13-3.html). (12.c) says "The validity of a given address depends on the run-time model; thus, in order to use Address clauses correctly, one needs intimate knowledge of the run-time model." Under Implementation Advice, (15-16) say "The recommended level of support for the Address attribute is: "X'Address should produce a useful result if X is an object that is aliased or of a by-reference type, or is an entity whose Address has been specified." There is nothing specific about whether the value can change. -- Jeff Carter "We'll make Rock Ridge think it's a chicken that got caught in a tractor's nuts!" Blazing Saddles 87
If the type of the object is limited, then the object address is a constant. For other objects there is no such guaranty I guess.
On Saturday, April 1, 2023 at 3:39:51 AM UTC-4, Dmitry A. Kazakov wrote: > On 2023-03-31 23:44, Anatoly Chernyshev wrote: > > Data science people swear it's just a matter of the size of training set used... > They lie. In machine learning overtraining is as much a problem as > undertraining. The simplest example from mathematics is polynomial > interpolation becoming unstable with higher orders. > > And this does not even touch contradictory samples requiring retraining > or time constrained samples etc. > > I did also a few tests on some simple chemistry problems. ChatGPT looks like a bad but diligent student, who memorized the formulas, but has no clue how to use them. Specifically, units conversions (e.g. between mL, L, m3) is completely off-limits as of now. > One must remember that ChatGPT is nothing but ELIZA on steroids. > > https://en.wikipedia.org/wiki/ELIZA > -- > Regards, > Dmitry A. Kazakov > http://www.dmitry-kazakov.de For what it's worth on the subject of the chatbot, " "Produce Ada code for solving a quadratic equation." is a terrible choice for a test of ChatGPT as one is asking if it can do a Google search. To test its abilities, you have to pick a challenge that cannot be solved with a Google search. My short assessment of ChatGPT, with the history of chatbots, are available on my February blog post. I gave it a simple programming problem and it failed 3 times out of 4. It's not surprising as I've learned since February that the chatbot doesn't actually understand programming: it uses examples off the Internet and tries to predict what you might have typed based on keyword patterns. It is an imitation of an imitation, smoke and mirrors. This is why Vint Cerf denounced it. You can read my thoughts on my blog: https://www.pegasoft.ca/coder/coder_february_2023.html Ken Burtch
Thanks Phil! Huge help
A discussion in comp.arch (on the new C23 standard for C) brought up these questions, which I could not answer with confidence: - Is the address of an object constant in Ada? That is, if I have some object X in an Ada program, do repeated applications of X'Address always return the same value? - Does the answer depend on how X is allocated (created): on the library level, on the stack, or in a pool ("new")? The issue behind this question is whether an Ada program could use garbage collection that moves objects around, for example a compacting collector.
On Tuesday, April 4, 2023 at 3:50:10 PM UTC+2, Simon Wright wrote:
> Joakim Strandberg <joakim.s...@elk-studios.com> writes:
>
> > I've downloaded and installed the above on a M1 Apple laptop and it
> > works great. However, I can't compile .c files to be imported into an
> > Ada application:
> >
> > /opt/gcc-12.1.0/bin/aarch64-apple-darwin21-gcc -c -x c -MMD -MF
> > c_linux_api.d
> > -specs=/private/var/folders/1h/7qcblcxj6z92hg5sf_t39y140000gn/T/GNAT-TEMP-000004.TMP
> > /.../c_linux_api.c
> > <built-in>: error: unknown value '13.0.0' of '-mmacosx-version-min'
> > gprbuild: *** compilation phase failed
> >
> > I created an account on the MacAda list but was unauthorised to post
> > messages, therefore I make an attempt to post here. Is it possible to
> > compile C programming language files for import into an Ada
> > application on the Mac OS X with the new Apple silicon hardware? Or
> > should I just give up?
> You need to compile those C files with GCC 12.2.0 (or clang).
>
> This is the commit: https://github.com/gcc-mirror/gcc/commit/6725f186cb70d48338f69456864bf469a12ee5be
Thanks Simon, that does the trick. I can compile the C file with "clang -c c_linux_api.c" and then use the c_linux_api.o for the linking of the application. Thanks!
Best regards,
Joakim
Joakim Strandberg <joakim.strandberg@elk-studios.com> writes: > I've downloaded and installed the above on a M1 Apple laptop and it > works great. However, I can't compile .c files to be imported into an > Ada application: > > /opt/gcc-12.1.0/bin/aarch64-apple-darwin21-gcc -c -x c -MMD -MF > c_linux_api.d > -specs=/private/var/folders/1h/7qcblcxj6z92hg5sf_t39y140000gn/T/GNAT-TEMP-000004.TMP > /.../c_linux_api.c > <built-in>: error: unknown value '13.0.0' of '-mmacosx-version-min' > gprbuild: *** compilation phase failed > > I created an account on the MacAda list but was unauthorised to post > messages, therefore I make an attempt to post here. Is it possible to > compile C programming language files for import into an Ada > application on the Mac OS X with the new Apple silicon hardware? Or > should I just give up? You need to compile those C files with GCC 12.2.0 (or clang). This is the commit: https://github.com/gcc-mirror/gcc/commit/6725f186cb70d48338f69456864bf469a12ee5be
On Saturday, November 26, 2022 at 9:07:54 AM UTC+1, Blady wrote:
> Hello,
>
> This is XNAdaLib 2022 built on macOS 12.6 Monterey for Native Quartz
> with GNAT FSF 12.1
> (github.com/simonjwright/distributing-gcc/releases/tag/gcc-12.1.0-x86_64)
> including:
>
> - GTKAda 22.2 (www.adacore.com/gtkada ) with GTK+ 3.24.33 (www.gtk.org)
> complete,
> - Glade 3.40.0 (glade.gnome.org),
> - Florist mid-2022a (github.com/Blady-Com/florist),
> - AdaCurses 6.3 (patch 20221105)
> (invisible-island.net/ncurses/ncurses-Ada95.html),
> - Gate3 0.5d (sourceforge.net/projects/lorenz),
> - Components 4.64 (www.dmitry-kazakov.de/ada/components.htm),
> - AICWL 3.25 (www.dmitry-kazakov.de/ada/aicwl.htm),
> - Zanyblue 1.4.0 (zanyblue.sourceforge.net),
> - PragmARC mid-2022 (pragmada.x10hosting.com/pragmarc.htm),
> - UXStrings 0.4.0 (github.com/Blady-Com/UXStrings) - NEW
> - GNOGA 2.2 mid-2022 (www.gnoga.com),
> - SparForte 2.5 (sparforte.com),
> - HAC 0.21 (https://hacadacompiler.sourceforge.io)
>
> Here is also GNATStudio 23.0wb as a stand alone app for macOS 12.
> See readme for important details.
> There could be some limitations that you might meet. Feel free to report
> them on MacAda list (http://hermes.gwu.edu/archives/gnat-osx.html). Any
> help will be really appreciated.
>
> Both packages have been post on Source Forge:
> https://sourceforge.net/projects/gnuada/files/GNAT_GPL%20Mac%20OS%20X/2022-monterey
>
> Enjoy, Pascal.
> http://blady.pagesperso-orange.fr
Hi,
I've downloaded and installed the above on a M1 Apple laptop and it works great. However, I can't compile .c files to be imported into an Ada application:
/opt/gcc-12.1.0/bin/aarch64-apple-darwin21-gcc -c -x c -MMD -MF c_linux_api.d -specs=/private/var/folders/1h/7qcblcxj6z92hg5sf_t39y140000gn/T/GNAT-TEMP-000004.TMP /.../c_linux_api.c
<built-in>: error: unknown value '13.0.0' of '-mmacosx-version-min'
gprbuild: *** compilation phase failed
I created an account on the MacAda list but was unauthorised to post messages, therefore I make an attempt to post here. Is it possible to compile C programming language files for import into an Ada application on the Mac OS X with the new Apple silicon hardware? Or should I just give up?
Best regards,
Joakim
In article <fantome.forums.tDeContes-079FD6.18515603042022@news.free.fr>, Thomas <fantome.forums.tDeContes@free.fr.invalid> wrote: > In article <f9d91cb0-c9bb-4d42-a1a9-0cd546da436cn@googlegroups.com>, > Vadim Godunko <vgodunko@gmail.com> wrote: > > > On Sunday, April 18, 2021 at 1:03:14 AM UTC+3, DrPi wrote: > > > > What's the way to manage Unicode correctly ? > > Ada doesn't have good Unicode support. :( So, you need to find suitable set > > of "workarounds". > > > > There are few different aspects of Unicode support need to be considered: > > > > 1. Representation of string literals. If you want to use non-ASCII > > characters > > in source code, you need to use -gnatW8 switch and it will require use of > > Wide_Wide_String everywhere. > > 2. Internal representation during application execution. You are forced to > > use Wide_Wide_String at previous step, so it will be UCS4/UTF32. > > > It is hard to say that it is reasonable set of features for modern world. > > I don't think Ada would be lacking that much, for having good UTF-8 > support. > > the cardinal point is to be able to fill a > Ada.Strings.UTF_Encoding.UTF_8_String with a litteral. > (once you got it, when you'll try to fill a Standard.String with a > non-Latin-1 character, it'll make an error, i think it's fine :-) ) > > does Ada 202x allow it ? hi ! I think I found a quite nice solution! (reading <t3lj44$fh5$1@dont-email.me> again) (not tested yet) it's not perfect as in the rules of the art, but it is: - Ada 2012 compatible - better than writing UTF-8 Ada code and then telling gnat it is Latin-1 (in this way it would take UTF_8_String for what it is: an array of octets, but it would not detect an invalid UTF-8 string, and if someone tells it's really UTF-8 all goes wrong) - better than being limited to ASCII in string literals - never need to explicitely declare Wide_Wide_String: it's always implicit, for very short time, and AFAIK eligible for optimization package UTF_Encoding is subtype UTF_8_String is Ada.Strings.UTF_Encoding.UTF_8_String; function "+" (A : in Wide_Wide_String) return UTF_8_String renames Ada.Strings.UTF_Encoding.Wide_Wide_Strings.Encode; end UTF_Encoding; then we can do: package User is use UTF_Encoding; My_String : UTF_8_String := + "Greek characters + smileys"; end User; if you want to avoid "use UTF_Encoding;", i think "use type UTF_Encoding.UTF_8_String;" doesn't work, but this should work: package UTF_Encoding is subtype UTF_8_String is Ada.Strings.UTF_Encoding.UTF_8_String; type Literals_For_UTF_8_String is new Wide_Wide_String; function "+" (A : in Literals_For_UTF_8_String) return UTF_8_String renames Ada.Strings.UTF_Encoding.Wide_Wide_Strings.Encode; end UTF_Encoding; package User is use type UTF_Encoding.Literals_For_UTF_8_String; My_String : UTF_Encoding.UTF_8_String := + "Greek characters + smileys"; end User; what do you think about that ? good idea or not ? :-) -- RAPID maintainer http://savannah.nongnu.org/projects/rapid/
It based on Qt-6.5.0-everywhere opensource (expanded with modules from Qt-5.15: qtgamepad, qtx11extras,qtwinextras),VTK-9.2.0,FFMPEG-5.2.1,OpenCV-4.7.0,SDL2-2.24.0,QtAV-1.13 MDK-SDK(wang-bin) Qt6ada version 6.5.0 open source and qt6base.dll ,qt6ext.dll (win64),libqt6base.so,libqt6txt.so(x86-64) built with Microsoft Visual Studio 2023 x64 Windows, gcc amd64 in Linux. Package tested with gnat gpl 2020 ada compiler in Windows 64bit , Linux amd64 Debian 11.2 AdaStudio-2023 includes next modules : qt6ada,vtkada,qt6mdkada,qt6cvada(face recognition, face detection,face identification,objects detectection,QRcode detector,BARcode detection and others ) and voice recognizer. Qt6Ada is built under GNU LGPLv3 license https://www.gnu.org/licenses/lgpl-3.0.html. Qt6Ada modules for Windows, Linux (Unix) are available from Google drive https://drive.google.com/drive/folders/0B2QuZLoe-yiPbmNQRl83M1dTRVE?resourcekey=0-b-M35gZhynB6-LOQww33Tg&usp=sharing WebPage is https://r3fowwcolhrzycn2yzlzzw-on.drv.tw/AdaStudio/index.html Directories tree is AdaStudio – root Prebuilt - Qt-6.5.0, VTK-9.2.0, FFMPEG-5.2.1,Opencv-4.6.0,SDL2-2.24.0,QtAV MDK-SDK Win64 - prebuilt for Windows x64 qt-6.5.0win64.tar.xz - Qt-6.5.0 vtk-9.2.0win64.tar.xz - VTK-9.1.0 ffmpeg-5.2.1win64.tar.xz - FFMPEG-5.2.1 opencv-4.7.0win64.tar.xz - OpenCV-4.7.0 sdl2-2.24.0win64.tar.xz - SDL2-2.0.24 qtav1.133win64.tar.xz - QtAV 1.13(compatible with ffmpeg 5) AMD64 - prebuilt binaries for Linux/Unix Desktop amd64 qt-6.5.0amd64.tar.xz - Qt-6.5.0 vtk-9.2.0amd64.tar.xz - VTK-9.2.0 ffmpeg-5.2.3amd64.tar.xz - FFMPEG-5.2.3 opencv-4.7.0amd64.tar.xz - OpenCV-4.7.0 sdl2-2.24.0amd64.tar.xz - SDL2-2.24.0 qtav1.133win64.tar.xz - QtAV 1.13(compatible with ffmpeg 5) qt6ada - qt6ada components qt6adademos.tar.xz - qt6ada demos qt6adasrc.tar.xz - qt6ada packages qt6adawin64.tar.xz - qt6ada win64 binaries qt6adaamd64.tar.xz - qt6ada x86-64 binaries mdkada - qt6mdkada components qt-qmdk.ads - qt6mdkada package mdkadademos.tar.bz2 - qt6mdkada demos mdkadawin64.tar.bz2 - qt6mdkada win64 binaries mdkadaamd64.tar.bz2 - qt6mdkada amd64 binaries mdk-sdk-0.16.0.tar.xz - mdk-sdk binaries win64 amd64 qtavada - qt6avada components qt6avadasrc.tar.xz - qt6avada packages qt6avadademos.tar.xz - qt6avada demos qt6avadawin64.tar.xz - qt6avada win64 binaries qt6adaamd64.tar.xz - qt6avada amd64 binaries qtopencvada - qt6opencvada components (with seeta,ndnn,yolov models support) qt6opencvadademos.tar.xz - qt6opencvada demos qt6opencvadasrc.tar.xz - qt6opencvada packages qt6opencvadawin64.tar.xz - qt6opencvada win64 binaries qt6opencvadaamd64.tar.xz - qt6opencvada amd64 binaries voicerecognizer - qt6ada voicerecognizer components qt6speech2textwin64.tar.bz2 - qt6voicerecognizerada win64 binries qt6speech2textx86-64.tar.bz2 - qt6voicerecognizerada amd64 binries speech2textdemo.tar.bz2 - qt6voicerecognizerada demos speech2textsrc.tar.bz2 - qt6voicerecognizerada packages vtkada - vtk9ada componenets vtkadademo.tar.xz - vtkada demos vtkadasrc.tar.xz - vtkada packages vtkadawin64.tar.xz - vtkada win64 binaries vtkadaamd64.tar.xz - vtkada amd64 binaries The full list of released classes is in "Qt6 classes to Qt6Ada packages relation table.pdf" The simple manual how to build Qt6Ada application can be read in "How to use Qt6ada.pdf" If you have any problems or questions, tell me know. Leonid(leonid.dulman@gmail.com)
Le 01/04/2023 à 20:57, Hou Van Boere a écrit :
> Thanks for the fantastic help today DrPi
You're welcome :)
Thanks for the fantastic help today DrPi
Le 01/04/2023 à 19:24, Hou Van Boere a écrit : > I am sure you are right but still, you get the general idea. > > Thermo Electron has pretty much bought most of the industry out. I will copy and paste, mix and match old stuff to re-implement instruments they don't care about anymore. I don't need to make anything cutting edge. The old stuff was more than good enough Indeed, an interesting project. You first need a Ada cross-compiler. Here is a link about this : https://wiki.osdev.org/GNAT_Cross-Compiler You also need a runtime. This is up to you to code it. You can use bbruntimes as a template. This can request modifications on your hardware. For example, the runtime needs a timer to track time. If your microprocessor do not have an embedded timer, you'll have to add one on your board. Other links of interest : https://forum.ada-lang.io/ https://github.com/ohenley/awesome-ada Matrix rooms (https://matrix.org/clients) : Ada news : https://matrix.to/#/#ada-lang:matrix.org Ada language : https://matrix.to/#/#ada-lang:matrix.org Alire : https://matrix.to/#/#ada-lang_Alire:gitter.im Many other resources exist.
I am sure you are right but still, you get the general idea. Thermo Electron has pretty much bought most of the industry out. I will copy and paste, mix and match old stuff to re-implement instruments they don't care about anymore. I don't need to make anything cutting edge. The old stuff was more than good enough
Le 01/04/2023 à 18:58, Hou Van Boere a écrit :
> Thanks DrPi
>
> I will probably stick with what I know. Most of the instruments I work on have Motorola chips and parallel buses. I don't think i will use SPi, IC2 or dozens of other protocols/features found in most modern circuit boards.
Great chips at their time but I'm afraid you'll have hard time compiling
a dedicated GNAT compiler.
Le 01/04/2023 à 18:42, Hou Van Boere a écrit :
> Thanks for your feedback Niklas. I am new to Ravenscar(just spelled it wrong today), this is very helpful.
>
> It would be nice to have threads but I am not sure I actually need them.
>
> I have serviced scientific instruments for 24 years now. I want to start fabricating them. I will have some bumps along the way with PCB design but I am confident that it will work out.
>
> I have been playing around with Ada since 2012 but I still have lots to learn and I don't program in the day so it is not my strong suit. The hardware side should work out but I am worried about the software end of things. Ada is lovely but massive. There are so many features, so many libraries(some of which are abandoned). There are only so many hours in a day.
>
> I have a subset of the language I like and if I can just control CPU address and data lines, I shouldn't need a RTOS. Trying several of them out could take a great deal of time.
>
> I don't seem to have any extra runtimes with my install:
Today, the easiest route is to use ARM based chips as there are
maintained runtimes for them (through Alire and bbruntimes).
Thanks for the link
Thanks DrPi I will probably stick with what I know. Most of the instruments I work on have Motorola chips and parallel buses. I don't think i will use SPi, IC2 or dozens of other protocols/features found in most modern circuit boards.
Le 01/04/2023 à 18:50, Hou Van Boere a écrit : > " Could you tell me where to find the light runtimes? I have only worked with Ada on full desktops. Does the FSF version ship with light runtimes?" > > I am just answering my own question to avoid wasting people's time. I fount this: > https://github.com/AdaCore/bb-runtimes The best way is to use Alire https://alire.ada.dev/
>> 1)I want to build my own circuit board with a microprocessor not
>> microcontroller.
>
>
> Can you explain why? Input/output is often more complex with a
> microprocessor (I assume you mean something that could run a PC or a
> tablet) than with a microcontroller. A microprocessor may need a lot of
> complex initialization and driver SW which you can get in some RTOS but
> not in an Ada RTS. And I believe that circuit-board design is more
> complex for microprocessors than for microcontrollers, however I have no
> experience with either case.
Nowadays, microprocessors are rare. Even x86 microprocessors could be
named microcontrollers since they integrate many (not all) peripherals.
High end microcontrollers are very complex to initialize. Especially
since they integrate security functionalities (like secure boot), SDRAM
controllers, PCIe controllers, Gigabit Ethernet controllers, 3D GPUs,
video encoders/decoders, camera interface, LCD interface, HDMI interface...
Even middle range microcontrollers are (very) complex.
Manufacturers provide drivers source code (in C) for all peripherals.
They also provide tools to graphically set chip configuration and output
C code to help the programmer.
Complexity depends on the chip you choose.
" Could you tell me where to find the light runtimes? I have only worked with Ada on full desktops. Does the FSF version ship with light runtimes?" I am just answering my own question to avoid wasting people's time. I fount this: https://github.com/AdaCore/bb-runtimes
yes thanks -ffreestanding, -freestanding was a typo, sorry
Thanks for your feedback Niklas. I am new to Ravenscar(just spelled it wrong today), this is very helpful. It would be nice to have threads but I am not sure I actually need them. I have serviced scientific instruments for 24 years now. I want to start fabricating them. I will have some bumps along the way with PCB design but I am confident that it will work out. I have been playing around with Ada since 2012 but I still have lots to learn and I don't program in the day so it is not my strong suit. The hardware side should work out but I am worried about the software end of things. Ada is lovely but massive. There are so many features, so many libraries(some of which are abandoned). There are only so many hours in a day. I have a subset of the language I like and if I can just control CPU address and data lines, I shouldn't need a RTOS. Trying several of them out could take a great deal of time. I don't seem to have any extra runtimes with my install: gnatls -v GNATLS 11.2.0 Copyright (C) 1997-2021, Free Software Foundation, Inc. Source Search Path: <Current_Directory> /usr/lib64/gcc/x86_64-slackware-linux/11.2.0/adainclude Object Search Path: <Current_Directory> /usr/lib64/gcc/x86_64-slackware-linux/11.2.0/adalib Project Search Path: <Current_Directory> /usr/x86_64-slackware-linux/lib/gnat /usr/x86_64-slackware-linux/share/gpr /usr/share/gpr /usr/lib/gnat
Le 01/04/2023 à 18:12, Hou Van Boere a écrit : > " -freestanding isn't an option for gnatmake; where does it come from?" > Ha ha, chatGPT :) > I guess it is -ffreestanding : https://stackoverflow.com/questions/17692428/what-is-ffreestanding-option-in-gcc
Le 01/04/2023 à 16:29, Dirk Craeynest a écrit : >>>> Le 31/03/2023 à 19:45, Jeffrey R.Carter a écrit : >>>>> You could try contacting Riehle directly. > >>> On 2023-04-01 12:34, DrPi wrote: >>>> I would if I knew how to do it. > >> Le 01/04/2023 à 14:01, Jeffrey R.Carter a écrit : >>> I have 2 e-mail addresses for him. I wouldn't want to post them >>> publicly here. Is your posting address valid? > > In article <u097gm$j3i$1@shakotay.alphanet.ch>, DrPi <314@drpi.fr> wrote: >> It is. > > Earlier today I was in contact with Richard. I mentioned your request, > and gave him your e-mail address. Feel free to contact me, if Richard > would not write to you shortly. > > HTH Thanks a lot Dirk. Best, Nicolas > > Dirk
On 2023-04-01 15:26, Hou Van Boere wrote: > Hi Everyone. > > I know there are several floss RTOS option for us but I don't really > need all of the supports they offer and they just make things more > complex. Certainly using most RTOS from Ada is more complex than using an Ada RTS from Ada. Do you want to use tasking at all? Or just a single thread? > Here are my goals: > > 1)I want to build my own circuit board with a microprocessor not microcontroller. Can you explain why? Input/output is often more complex with a microprocessor (I assume you mean something that could run a PC or a tablet) than with a microcontroller. A microprocessor may need a lot of complex initialization and driver SW which you can get in some RTOS but not in an Ada RTS. And I believe that circuit-board design is more complex for microprocessors than for microcontrollers, however I have no experience with either case. > 2)I want to run with gcc/gnatmake ... -freestanding > > 3)I only need the Ada 83 subset, which I guess is pretty close to Ravenscaler I see the Ada 83 tasking features as almost orthogonal to Ravenscar. Ada 83 has no protected objects, and all inter-task communication must be done with rendez-vous using task entries. Ravenscar forbids task entries and rendez-vous and substitutes protected objects. Both work, but Ravenscar is perhaps more resistant to deadlock errors.
" -freestanding isn't an option for gnatmake; where does it come from?" Ha ha, chatGPT :) Could you tell me where to find the light runtimes? I have only worked with Ada on full desktops. Does the FSF version ship with light runtimes?
[-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain, Size: 637 bytes --] >>> Le 31/03/2023 à 19:45, Jeffrey R.Carter a écrit : >>>> You could try contacting Riehle directly. >> On 2023-04-01 12:34, DrPi wrote: >>> I would if I knew how to do it. >Le 01/04/2023 à 14:01, Jeffrey R.Carter a écrit : >> I have 2 e-mail addresses for him. I wouldn't want to post them >> publicly here. Is your posting address valid? In article <u097gm$j3i$1@shakotay.alphanet.ch>, DrPi <314@drpi.fr> wrote: >It is. Earlier today I was in contact with Richard. I mentioned your request, and gave him your e-mail address. Feel free to contact me, if Richard would not write to you shortly. HTH Dirk
Le 01/04/2023 à 15:05, Dmitry A. Kazakov a écrit :
> On 2023-04-01 14:32, DrPi wrote:
>> Le 01/04/2023 à 13:14, Dmitry A. Kazakov a écrit :
>
>>> Anyway, you can install Calibre. It has an integrated format
>>> conversion tool and plug-ins to remove DRM (e.g. by conversion AZW to
>>> MOBI). Unless you blindly trust Amazon services... otherwise archive
>>> and backup your library.
>>>
>> If there is a simpler solution, I get it ;)
>
> You need to manage the library anyway regardless where you get the
> e-books. Calibre does pretty much everything one needs.
>
As I don't own a e-book device, I never tried Calibre.
Hou Van Boere <houvanboere@gmail.com> writes: > 2)I want to run with gcc/gnatmake ... -freestanding -freestanding isn't an option for gnatmake; where does it come from? > 3)I only need the Ada 83 subset, which I guess is pretty close to Ravenscaler The Ada 83 subset is going to be larger than Ravenscar. If you don't want an RTOS you could use one of the light runtimes, e.g. light-cortex-m0.
On 2023-04-01 14:32, DrPi wrote: > Le 01/04/2023 à 13:14, Dmitry A. Kazakov a écrit : >> Anyway, you can install Calibre. It has an integrated format >> conversion tool and plug-ins to remove DRM (e.g. by conversion AZW to >> MOBI). Unless you blindly trust Amazon services... otherwise archive >> and backup your library. >> > If there is a simpler solution, I get it ;) You need to manage the library anyway regardless where you get the e-books. Calibre does pretty much everything one needs. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
Le 01/04/2023 à 13:14, Dmitry A. Kazakov a écrit : > On 2023-03-31 16:13, DrPi wrote: > >> I have no problem buying it but I don't want a kiddle format. >> Anyone knows of a pdf format somewhere ? > > There is nothing wrong with MOBI or, maybe, you mean AZW? > I try to avoid Amazon as much as possible. The Kindle ecosystem is terrible. > Anyway, you can install Calibre. It has an integrated format conversion > tool and plug-ins to remove DRM (e.g. by conversion AZW to MOBI). Unless > you blindly trust Amazon services... otherwise archive and backup your > library. > If there is a simpler solution, I get it ;)
Hi Everyone. I know there are several floss RTOS option for us but I don't really need all of the supports they offer and they just make things more complex. Here are my goals: 1)I want to build my own circuit board with a microprocessor not microcontroller. 2)I want to run with gcc/gnatmake ... -freestanding 3)I only need the Ada 83 subset, which I guess is pretty close to Ravenscaler What options do I have? I like to keep things small and simple when possible. Thanks for reading
Le 01/04/2023 à 14:01, Jeffrey R.Carter a écrit :
> On 2023-04-01 12:34, DrPi wrote:
>> Le 31/03/2023 à 19:45, Jeffrey R.Carter a écrit :
>>>
>>> You could try contacting Riehle directly.
>>>
>> I would if I knew how to do it.
>
> I have 2 e-mail addresses for him. I wouldn't want to post them publicly
> here. Is your posting address valid?
>
It is.
I have the same concerns. There are websites that allow for temp phone numbers but they never work. Get a burners phone with a pay as you go plan that does not auto-renew. Maybe you already have a retired phone. A simm card will be $10 and a month's worth of talk time perhaps another $10. Wish it was easier :(