Normal view

There are new articles available, click to refresh the page.
Before yesterdayAda Forum - Latest topics

"Unmatched actual" in instantiation of a generic package

By: Eric
10 July 2023 at 14:10

I’m trying to instantiate a generic hash map package in SPARK. The instantiation compiles as legal Ada, but SPARK is giving me the additional error

error: unmatched actual in instantiation of “Formal_Hashed_Maps” declared at a-cfhama.ads:33
package Boolean_Maps is new Ada.Containers.Formal_Hashed_Maps(Module_ID_Type, Boolean, Hash_Func, Equivalent_Key, Standard.“=”);

with a red underline under Module_ID_Type.

Module_ID_Type is defined in a non-generic package as type Module_ID_Type is new Positive range 1..255. I’m using the GNAT compiler. The code compiles and works as expected.

What does this error mean?

Thanks.

2 posts - 2 participants

Read full topic

HAC version 0.26

8 July 2023 at 06:29

Main URL: https://hacadacompiler.sourceforge.io/
Sources, site #1: HAC Ada Compiler download | SourceForge.net
Sources, site #2: GitHub - zertovitch/hac: HAC Ada Compiler - a small, quick Ada compiler fully in Ada
Alire Crate: Alire - Hac

What’s new:

  • You can use a loop’s name for the exit statement: exit Loop_Name.
  • You can exit multiple, nested, loops, by using exit Loop_Name.
  • Ada semantics are better verified:
    • Array indexing (i)(j) (array of array) and (i,j) (multi-dimensional array) are no more treated as equivalent (this feature was a remnant of the Pascal syntax).
    • Separation between Type and Subtype declarations (anonymous types are allowed only in the few cases foreseen by the language).
    • Operators of the HAT package (+, -, &) are visible without prefix only in the scope of a use HAT; clause.

Note that correct Ada programs, in relation to the above points, were already accepted and parsed correctly by HAC before that change.

Finally, a bit of cosmetics in the build messages:

C:\Ada\hac\exm>..\hac -v2 -c pkg_demo.adb

*******[ HAC ]*******   HAC is free and open-source. Type "hac" for license.
       [ HAC ]          HAC Ada Compiler version 0.26, 08-Jul-2023
       [ HAC ]          Compiling main: pkg_demo.adb
       [ HAC ]          | Compiling x_pkg_demo_s.ads (specification)
       [ HAC ]           \ Compiling x_pkg_demo_s1.ads (specification)
       [ HAC ]            \ Compiling x_pkg_demo_s11.ads (specification)
       [ HAC ]            /           x_pkg_demo_s11.ads: done.
       [ HAC ]            \ Compiling x_pkg_demo_s12.ads (specification)
       [ HAC ]            /           x_pkg_demo_s12.ads: done.
       [ HAC ]            \ Compiling x_pkg_demo_s13.ads (specification)
       [ HAC ]            /           x_pkg_demo_s13.ads: done.
       [ HAC ]           /           x_pkg_demo_s1.ads: done.
       [ HAC ]           \ Compiling x_pkg_demo_s2.ads (specification)
       [ HAC ]            \ Compiling x_pkg_demo_s21.ads (specification)
       [ HAC ]            /           x_pkg_demo_s21.ads: done.
       [ HAC ]            \ Compiling x_pkg_demo_s22.ads (specification)
       [ HAC ]            /           x_pkg_demo_s22.ads: done.
       [ HAC ]            \ Compiling x_pkg_demo_s23.ads (specification)
       [ HAC ]            /           x_pkg_demo_s23.ads: done.
       [ HAC ]           /           x_pkg_demo_s2.ads: done.
       [ HAC ]           \ Compiling x_pkg_demo_s3.ads (specification)
       [ HAC ]            \ Compiling x_pkg_demo_s31.ads (specification)
       [ HAC ]            /           x_pkg_demo_s31.ads: done.
       [ HAC ]            \ Compiling x_pkg_demo_s32.ads (specification)
       [ HAC ]            /           x_pkg_demo_s32.ads: done.
       [ HAC ]            \ Compiling x_pkg_demo_s33.ads (specification)
       [ HAC ]            /           x_pkg_demo_s33.ads: done.
       [ HAC ]           /           x_pkg_demo_s3.ads: done.
       [ HAC ]          |           x_pkg_demo_s.ads: done.
       [ HAC ]          | Compiling x_pkg_demo_m.ads (specification)
       [ HAC ]          |           x_pkg_demo_m.ads: done.
       [ HAC ]          | Compiling x_pkg_demo_b.ads (specification)
       [ HAC ]          |           x_pkg_demo_b.ads: done.
       [ HAC ]          Compilation of pkg_demo.adb (main) completed
       [ HAC ]          ------  Compilation of eventual with'ed unit's bodies  ------
       [ HAC ]          | Compiling x_pkg_demo_s.adb (body)
       [ HAC ]          |           x_pkg_demo_s.adb: done.
       [ HAC ]          | Compiling x_pkg_demo_s1.adb (body)

6 posts - 3 participants

Read full topic

GNAT Pro Roadmap

7 July 2023 at 16:20

AdaCore posted an updated roadmap for GNAT Pro. Lots to look forward to here: LLVM, CUDA, FreeRTOS, Alire integration.

AdaCore Product Roadmap

6 posts - 6 participants

Read full topic

Questions about concurrency with Ghost data in SPARK

By: Eric
28 June 2023 at 16:22

I’m working on a system in SPARK and am confused by a warning SPARK is giving about data races.

I’m working on a message passing system that manages several endpoints. There are multiple types of messages. Each message is a record with a Message_Type component specifying the type of the message. To use the system, endpoints use a register procedure and declare what message types they’re allowed to receive.

The system tracks what types of messages can be received by each endpoint in an abstract package state Metadata with Ghost belonging to the message system package. The Send_Message procedure then has preconditions that check with the message system to verify that the receiving endpoint has declared it can receive the type of message being sent.

All the endpoints are initialized at the start of the program by a single thread. Later in the program they’re used by different threads. These later threads will never need to alter Metadata. They take it as a Proof_In global variable.

SPARK is saying that there is a data race possible because the multiple threads are using the Metadata state.

cubedos-time_server-messages.adb:85:09: high: possible data race when accessing variable “message_manager.mailbox_metadata”[#2]
cubedos-time_server-messages.adb:85:09: high: task “cubedos.time_server.messages.send_tick_messages” accesses “message_manager.mailbox_metadata”[#3]
cubedos-time_server-messages.adb:85:09: high: task “cubedos.time_server.messages.message_loop” accesses “message_manager.mailbox_metadata”[#4]

How is this possible? If Metadata is Ghost, shouldn’t it never actually be evaluated at runtime?

Suppose that Metadata wasn’t Ghost. Is there a way I can communicate to SPARK that Metadata should be immutable after all the endpoints are initialized?

Thank you.
Any light

4 posts - 3 participants

Read full topic

Using AWS with Alire and SSL

By: stcarrez
25 June 2023 at 08:03

By default when you use AWS in an Alire project, you have executed some alr with aws command or added the following line to your Alire toml configuration file:

[[depends-on]]
aws = "~23.0"

Then you are happy to compile your project and use AWS but you may get a cryptic Program_Error exception that is raised when you have your AWS client that tries to connect to a server using https:

aws-client.adb:608 finalize/adjust raised exception

Despite the fact that AWS project is configured with OpenSSL support, it will not use it by default.
Indeed, the AWS project is using the SOCKET configuration which is not configured by default in the GNAT project. Hopefully, you can fix that by building your project with:

alr build -- -XSOCKET=openssl

Now, to avoid the cryptic Program_Error exception, it is also best to check for SSL support in AWS by using a test such as:

if not AWS.Net.SSL.Is_Supported then
  -- No SSL support, report a cleaver error message
end if;

3 posts - 3 participants

Read full topic

Ada 2022 Language Standard to be Published by Springer

14 June 2023 at 07:19

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:
Ada 2022 Language Reference Manual.
An overview of Ada 2022 is at:
Ada 2022 Overview.

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.

www.ada-europe.org/press/20230614-Ada2022-Springer.pdf

#Ada2022 #AdaEurope #AdaProgramming

5 posts - 3 participants

Read full topic

AEiC 2023 - 27th Ada-Europe Int'l Conference on Reliable Software Technologies

9 June 2023 at 11:20

Tue 13 - Fri 16 June 2023

Final call: check out rich conference, tutorial, and workshop program!
Final Program available on conference web site.
Interested in Ada or reliable software? See you in Lisbon, Portugal!

For all information: Ada-Europe 2023, and our Usenet newsgroup postings for an overview.

#AEiC2023 #AdaEurope #AdaProgramming

1 post - 1 participant

Read full topic

Ada-based applications in Android?

By: Guille
7 June 2023 at 08:53

Hello,
I have been struggling to make my Ada program run on Android (through a Java native interface), with so far no results. As I understand it, the generic Linux GCC compiler will not make the job, because even if it targets the right architecture (arm64), the compiler toolchain needs to be built using Android “binutils”. Is it like that (or even more complex than that)?
In any case, frustrated by the fact that my SAL generated with gprbuild and GCC will refuse to work (at least with the FSF compiler), I posted my issue on Stack Overflow, and somebody threw the idea of using LLVM instead. So I was wondering if the Gnat LLVM project could help me here.
I started reading about LLVM, and I find it a bit hard to grasp. My current understanding is that I could use it to compile Ada into IR code, that would be then compiled into machine code for an specific architecture, without requiring the installation of a particular cross compiler. Is that right?
Is it theoretically feasible to generate a SAL with a Java interface for Android using this toolchain? And if so, how?
Otherwise, could somebody expose the purpose and/or usages of Gnat LLVM?

Before you react, please know that my understanding of compilers is very limited…
In case you are curious about what I am doing, my project is open source, you can take a look at it here:

8 posts - 3 participants

Read full topic

Qplt (Quick Plot)

By: JC001
2 June 2023 at 15:52

Seen on c.l.a:

I have created Qplt (Quick Plot), an 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

Enjoy.

10 posts - 4 participants

Read full topic

LEA v.0.87

29 May 2023 at 18:17

LEA is a Lightweight Editor for Ada

Web site: http://l-e-a.sf.net/
Source repository #1: LEA / Code / [r343]
Source repository #2: GitHub - zertovitch/lea: LEA is a Lightweight Editor for Ada

Recent changes:

  • 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!

3 posts - 2 participants

Read full topic

GWindows release, 29-May-2023

29 May 2023 at 18:15

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.

GWindows Project site:

GWindows GitHub clone:

Enjoy!

1 post - 1 participant

Read full topic

❌
❌