Questions tagged [ada]

Ada is a structured, statically typed, imperative, wide-spectrum, and object-oriented high-level computer programming language, extended from Pascal and other languages.

ada
Filter by
Sorted by
Tagged with
1 vote
1 answer
66 views

Missing libgnat-2020.dylib when using runtime library (MacOS)

I'm trying to figure out how to build and link dynamic libraries with Ada, and I've encountered an issue I can't seem to figure out. Might just be a bug on MacOS. Here is my setup: I've created a ...
-1 votes
1 answer
57 views

Alire macOS Sonoma GTKAda "gtk.ads" not found when compiling a simple "Hello, World!" program

I am having trouble compiling and running a simple GTKAda "Hello, World!" program on a macOS Sonoma M3 Mac. I'm using "alr-6768bdb" from GitHub it's the 11, December 2023 beta ...
2 votes
2 answers
369 views

Ada: Difference between interface and abstract tagged type?

According to Adaic, an interface in Ada is defined as a "tagged type with no components and no concrete operations". It can be used for multiple inheritance. In contrast, an abstract type is ...
6 votes
2 answers
7k views

Constant declaration in Ada

Being new to Ada, I'm exploring its syntax and rules and I would like to draw attention on the code given next. Here I'm trying to set a variable Actual_Stiffness to hold a constant value. Its value ...
0 votes
0 answers
84 views

How to properly handle byte buffers from C to Ada?

I'm trying to create a simple Ada program that would encrypt/decrypt files using the OpenSSL libcrypto library. One of the issues I'm facing is handling output streams properly. Trying to achieve ...
0 votes
1 answer
79 views

ADA problem with value by reference or post conditions

I have a problem with a 'simple' ADA program. This exercise aim at learning value by reference and post condition in ADA. Here I want to build a simple function that sum two Integers where the first ...
1 vote
4 answers
100 views

Order of evaluation in assignment statements

The Ada 2012 standard says: For the execution of an assignment_statement, the variable_name and the expression are first evaluated in an arbitrary order. I am wondering how far reaching that ...
10 votes
2 answers
3k views

Is it possible to define a numeric range for a field in Protocol Buffer?

I live in a very safety/critical Ada-ic environment, and have taken the habit of having well defined and bounded type definition. I am also confronted to lots ASN1 usage/evangelists. One of the key ...
4 votes
2 answers
87 views

Why Ada attribute 'value in this snippet doesn't raise Data_Error but Constraint_Error instead?

The snippet use a My_Color'Value to convert from String to My_Color and it just raise the Constraint_Error but not the Data_Error as supposed it. The first block of code works if you enter a correct ...
2 votes
1 answer
793 views

How to check the input? Ada language

I've just started learning Ada and I cannot figure out how to keep the program running when the user input is beyond the declared range of a variable. I'd like to print info about bad range of input ...
3 votes
1 answer
105 views

How to write Recursive GCD program in Ada?

I need Recursive extended Gcd in ADA. I have two similar functions in C and Ada, but only C works. How to fix it? C: int extended_gcd(int a, int b, int* x, int* y) { if (b == 0) { *x = 1; *y = ...
3 votes
3 answers
340 views

Ada - How to generate a list of package variables from GNAT Pro Studio?

I'd like to use the xref information from a GPS Ada project to generate lists of the variables defined for each package spec and body. I need to exclude any variables defined inside of subprograms. ...
2 votes
1 answer
78 views

Access constant as subtype of general access type

For the null exclusion, it is possible to define a subtype of an access type that excludes the null values: type Day_Of_Month_Access is access Day_Of_Month; subtype ...
6 votes
3 answers
6k views

GUI in Ada programming language [closed]

How to make/create a GUI (Graphical User Interface) in Ada programming language? It is possible? In Python, you can use tkinter to make a window form.
1 vote
0 answers
75 views

Ada Calendar Arithmetic Difference 0 day between March 27 and March 28 2011

Why do I have the value 0 days between March 27, 2011 and March 28, 2011? with Ada.Calendar; use Ada.Calendar; with Ada.Calendar.Arithmetic; use Ada.Calendar.Arithmetic; with Ada.Text_IO; ...
8 votes
1 answer
943 views

Ada Numeric Literals and Underline

This is from the online Ada reference manual: http://www.adaic.org/resources/add_content/standards/05rm/RM.pdf (section 2.3) A decimal_literal is a numeric_literal in the conventional decimal ...
4 votes
1 answer
925 views

Ada/SPARK: should I be using GNATprove? Where can I find it?

On chapter 22.1 of this Learning Ada, trying to build the examples. It expects GNATprove to be installed. I am using Ubuntu 18.04 LTS, and I don't see any package that provides it. When I tried to ...
0 votes
0 answers
84 views

STORAGE_ERROR on assignment to array element

I have this array type: type Rowid_X_Mv is array (Metadata_Version range Mv_1_0 .. Mv_2_3) of Integer; where Metadata_Version is defined as: type Metadata_Version is (Mv_1_0, Mv_1_1, Mv_1_2, ...
2 votes
1 answer
80 views

How to conveniently parse a very specific chunk of a plaintext file in Ada?

I'm trying to read a URI Extension Block of a Share from Tahoe-LAFS in Ada. It looks something like this: codec_name:3:crs,codec_params:11:131073-3-10,crypttext_hash:32:..G.3u1~A..o;.w..k,..3.h....K....
1 vote
3 answers
74 views

Howto Re-Index an String in Ada?

I having the problem to Re-Index an Sliced string, procedure String_Test is mystr:String:="Hello World"; str:String:=mystr(6 .. 11); str_re_indexed:String:=Trim(Str, ...
2 votes
1 answer
122 views

How to add < and > check in case ... when?

I'm new to Ada programming language and working on an exercise, The instructions are as follows, • Write a case statement with 4 alternatives that displays information on a roll of a pair of dice. – A ...
1 vote
1 answer
98 views

How can I have more information in a Predicate_Failure?

I want to be able to include information about my type in the Predicate_Failure message. Here's what I have that works: subtype Norm is Float range 0.0..1.0; type Component is (Red, Green, Blue, ...
0 votes
1 answer
79 views

Tasking support in CortexM4-based board

I am experimenting with tasking in a Cortex M4 based board (specifically a stm32f429I one) but it looks like the runtime I'm using doesn't allow task hierarchy (which kind of make sense). To give a ...
2 votes
3 answers
871 views

Compile Ada for ARM architecture

Does anyone know of a compiler that will compile Ada on ARM (for Linux)? Preferably it would compile for at least Ada 2005.
0 votes
0 answers
60 views

Receiving a `r' Fatal Error when trying to build basic Ada code

I have had a new error show up on MacOS (intel x86) using the native AdaCore GNAT2019 toolchain. Assembler messages: Fatal error: invalid option `r' gprbuild:: *** compilation phase failed My code is:...
1 vote
2 answers
1k views

How can I define a structure that will contain two multidimensional unconstrained arrays an pass it to a procedure

I am new to Ada so, I have a question: How can I define a structure that will contain two multidimensional unconstrained arrays an pass it to a procedure. Following the code that I have wrote: package ...
0 votes
2 answers
169 views

MSYS2 - mingw64 Installing a package

i'm quite new to programming. I'm trying to install a compiler for my Vscode. I tried to use GNAT but i couldn't figure out how to install it, so I used mingw64. I followed the documentation online, ...
3 votes
0 answers
86 views

Injecting command line arguments in an Ada AUnit test

I would like to inject command line arguments in an Ada AUnit test so that the design under test could receive proper Ada.Command_Line property values. Concrete example: GHDL's procedure Main receives ...
1 vote
0 answers
71 views

Ada/Spark: Where is the "platinum" mode in gnatprove?

Maybe that is a realy silly question. But how do I prove for platinum? In the gnatprove help I find only the modes until "gold". Maybe "--mode=all" is the same as platinum? But I ...
1 vote
2 answers
4k views

How can I install Gnat Programming Studio (GPS) on Mac?

I managed to install the GNAT compiler from libre.adacore.com on a OS X v10.6.8 (Snow Leopard). I also would like to install the Gnat Programming Studio (GPS) environment. I tried different things, ...
1 vote
2 answers
3k views

How can I install ADA IDE and compiler on Mac (OS X)?

I downloaded GNAT ADA GPL 2014 and am now trying to install on my Mac. The directions below are the ones I am following, but where can I find the file called doinstall? Navigate to the directory that ...
0 votes
1 answer
757 views

ADA: GNAT on Android [closed]

I have managed to install GNAT on my OS X system, but now I would like to install it on my Android mobile phone in order to code... In my bed! Or in order to do homework while walking around the ...
5 votes
5 answers
1k views

Ada/C/++ distributed applications [closed]

I am trying to evaluate some technologies for implementing a communication process between some Ada modules with some C++/OpenGL modules. There is an (Windows XP) Ada application which communicates ...
2 votes
1 answer
116 views

Access-to-variable designates constant when trying to pass a pointer to vector element

This question is a follow-up to How to get access to a record field . The more complex (now) code involves binding a whole vector of records. Something along the lines below: type Tag is record ...
3 votes
1 answer
87 views

How to get access to a record field

Some general context for my problem first. I need to bind some arguments of a prepared statement using GNATCOLL SQLite bindings. These bindings expect C character pointer as an input (beside other ...
1 vote
2 answers
136 views

Square root of Big_Real in Ada

I am trying to calculate the square root of big numbers (around 16 digits) using the Big_Reals package. I have the following square root function which uses the Newton-Raphson method pragma Ada_2022; ...
0 votes
1 answer
273 views

Anagrams of a word in Ada Programming

How can I get anagrams of a word in ada programming. For example: I have a string 'one'. How can it be jumbled into 'neo' or 'eon' etc? example code: with Ada.Text_IO; use Ada.Text_IO; procedure ...
3 votes
1 answer
123 views

Overloaded Subprograms in Ada

Our Programming Languages professor told us that: "In Ada, the return type of an overloaded function can be used to disambiguate calls (thus two overloaded functions can have the same parameters)&...
0 votes
1 answer
90 views

How do you use the Reference_Type in Ada Hashed_Maps?

I want to create a symbol table as a hash map and keep a list of pointers into the symbol table to keep track of symbol table entries that need to be updated. I probably can't use cursors as pointers ...
1 vote
1 answer
102 views

What is "extension aggregate" and why do I need it?

I'm trying to use GNAT's SQLite bindings. And I want some way to get errors from these bindings. Trying to read through the code, I found that I can set up the connection by providing a mystery ...
0 votes
1 answer
440 views

I need some answers for solving these problems.I am stuck in these errors whilw programming in Ada using records

I am new to Ada programming.This is my ADA CODE for a program which gives me a list of things when typed a Football legend name in execution time.But I am getting the following errors.Please help me ...
4 votes
1 answer
4k views

Ada GPS IDE can't seem to find GtkAda

I have installed both the GNAT Programming Studio (GPS) and GtkAda. They both seem to work fine, but when I try to build the Simple Window project under New Project from Template, I get a bunch of ...
2 votes
1 answer
65 views

Problem with subtype usage in concurrent Ada program

I am working on a concurrent programming problem in Ada. The task is to simulate a bridge over which different cars can pass from different directions. The complication lies in the fact that, if an ...
2 votes
1 answer
92 views

Generating Ada bindings for C headers (Gem #59) doesn't work any more

When I used this method a few years ago, with Ada from the Ubuntu repository, it worked fine. Now, with my installation from Adacore, not so anymore. The method consists of 2 commands (time.h as ...
2 votes
1 answer
86 views

Type not visible in child package

I have the following parent package which defines several types aes.ads package AES is type Byte is range 0..2**8 - 1; type Input_Buffer is array(Natural range <>) of Byte; type ...
1 vote
1 answer
129 views

How to Overload the Subscript/Subprogram Call Operator in Ada

We all know and love Ada.Containers.Vectors. Here's an example of its usage: with Ada.Text_IO; with Ada.Containers.Vectors; procedure Example is use Ada.Text_IO; package Vectors_Integer is new ...
0 votes
2 answers
145 views

Ada design by contracts critical software

I have a question related to applying contracts in a critical environment. Imagine I have the following function to divide: function div (dividend, divisor : Float) return Float with Pre => divisor ...
-1 votes
1 answer
129 views

Trying to compile a simple Ada program, getting GNAT compiling error in OS 14.1 (23B73) on a M2 MBP

❯ alr build ⓘ Building myproj/myproj.gpr... Link [link] myproj.adb 0 0x10034af43 __assert_rtn + 64 1 0x10024cf43 ld::AtomPlacement::findAtom(unsigned char, unsigned long long, ld::...
1 vote
1 answer
90 views

I am trying to implement this using a circular queue. My program executes but says terminated succesfully when build&ran

LinkSort.adb file with Ada.Text_IO; use Ada.Text_IO; procedure LinkSort is type JobType is (Accountant, Analysist, Manager, Manufacturing, Programmer, Inventory, Sales, SoftwareEnginner); ...
3 votes
3 answers
156 views

Does Ada have a type equivalent to Pascal's set?

I'm learning Ada as a spare-time activity and, while I realise that it is greatly inspired by Pascal, I can't find a type that is similar to Pascal's set. set is built into the Pascal language itself ...

1
2 3 4 5
49