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.
2,246
questions
2
votes
1
answer
64
views
Ada: Null exclusion in arrays holding pointers
I was trying to use null excluded arrays holding access types in Ada.
Example:
type Integer_Access is access all Integer;
type MyArr is array (1 .. 2) of not null Integer_Access;
My compiler keeps ...
0
votes
1
answer
25
views
Visual Studio Code error: "No project found in root directory. Please create a project file and add it to the configuration."
I am setting up VSCode for Ada. I typed in a known good test program and tried to "Run -> Start Debugging". In the PROBLEMS (Crtl+Shift+M) window, a message appears:
"No project ...
1
vote
1
answer
77
views
Cannot Run GNATStudio - WSL
I've checked the other questions and this case doesn't seem to be covered. I'm running Ubuntu in WSL on my windows machine and I'm trying to run GNATStudio, any time I attempt to run the program ...
1
vote
2
answers
126
views
How to make terminal input invisible in Ada?
I need to secure input passwords in an Ada command line application. Are there any ready to use functions/procedures in GNAT or third-party libraries?
0
votes
0
answers
124
views
Is there some "standard" "elementary functions" support for fixed point data types in Ada?
Is there some "standard" elementary functions support for fixed point data types in Ada?
I would like to implement some stuff requiring exp on MCUs without fixed-point unit, partially even ...
0
votes
2
answers
111
views
How can I install the ZFP (Zero Foot Print) RTS (Run Time System) for AVR with the Alire package manager for Ada?
How can I install the ZFP (Zero Foot Print) RTS (Run Time System) for AVR with the Alire package manager for Ada?
My project file, I think correctly, contains:
project Avr is
for Runtime("Ada&...
0
votes
0
answers
58
views
Parametrizing blob types using gnatcoll.sql
I am using the Ada library gnatcoll.sql to create parametrizable SQL queries.
While I am able to create Integer parameters for type SQL_Field_Integer using the function:
function Integer_Param (Index :...
0
votes
1
answer
115
views
How to link an application written in Ada language?
I have a running a board with FreeRTOS. What do I need to do if I want to link an application written in Ada language?
Does the SDK source code of FreeRTOS need to be recompiled with GNAT?
How to ...
0
votes
2
answers
96
views
Using Ada, using instance of Ada.Numerics.Generic_Elementary_Functions(Real), calculating Nth root and output same
Using Ada 2018 (increment of 2012), within a loop structure, I need to calculate the Nth root of Integers.
In my package combinations.ads specification declaration (using GNAT GPS), I have
type Real ...
-1
votes
1
answer
81
views
Linking error using community edition 2021 on Fedora 36
I have used Ada successfully for years; but I am trying to create "hello world," and I am getting the following error:
/opt/GNAT/2021/bin/../libexec/gcc/x86_64-pc-linux-gnu/10.3.1/ld:
.gnu....
2
votes
2
answers
112
views
How to std::rotate in Ada?
Does an equivalent to std::rotate exist in the Ada standard libraries? If not, is there a consensus in the Ada community of some non-standard algorithms library for this sort of operation? I found ...
3
votes
1
answer
90
views
How to use different fix point types in mathematical operations in Ada?
For the program at the end I get the following error messages from gnat:
test2.adb:23:61: error: invalid operand types for operator "-"
test2.adb:23:61: error: left operand has type "...
2
votes
1
answer
83
views
How do I define and statically initialize a vector index by an enumeration?
I'm unable to define a vector using an enumeration as an index.
First I define my record:
type contact_name is record
first : unbounded_string;
last : unbounded_string;
end record;
I ...
0
votes
1
answer
105
views
Maximum line length Ada.Text_IO.Put_Line
I'm using GNATColl-sql to create SQL queries.
I was thinking to perform a visual inspection of the generated SQL code using the "To_String" method, but when I call Ada.Text_IO.Put_Line or ...
5
votes
1
answer
173
views
What is the idiomatic way to achieve ranged integers in Rust?
In the Ada programming language, one can use the range constraint to declare that the value of a signed integer has to be within a minimum and maximum. An exception is triggered if not, for example.
...
0
votes
0
answers
56
views
No language defined for the project: Ada GNAT GPS
I've been having this issue where I've installed the GNAT (x86 windows 2017) on my other machine, and I suddenly have these errors, Error: no native compiler found for language 'ada', default runtime ...
0
votes
0
answers
75
views
Defining a package with its sub units in Package Name?
I have run across code in Ncurses which defines packages with dot, "." subunits in the name, like this:
Package body example.subunit1.subunit1 is
....
....
end example;
Would I not just name ...
-1
votes
1
answer
114
views
Get output from array in Ada
I want to print array data user input.
But it give me error. I need to get input from user and store in the array. After this i want to print it also count each duplicate word.
with Ada.Text_IO;
use ...
0
votes
0
answers
62
views
gnatcoll-db includes dborm.py, need to understand routines in python
I was using gnatcoll-db, but the limitations made me to rewrite dborm.py in Ada. There are two routines in dborm.py (in python) that I don't understand, specifically compute_table_aliases and ...
0
votes
1
answer
112
views
Starting Gnat Studio with Alire fails
I have had a try at using Gnat Studio with the Alire package manager. Launching Gnat Studio using the 'alr edit' command is causing Gnat Studio to crash. I have had a look at the log file and there ...
0
votes
2
answers
231
views
Input masks in Ada
-- Date: 11/06/2022
with Ada.Text_IO; Use Ada.Text_Io;
procedure Masques is
type XX is record
X1 : character range 'A'..'D';
X2 : character range 'E'..'H';
X3 : character ...
1
vote
1
answer
133
views
Where is the actual character set for Ada program text defined?
I'm trying to make a tree-sitter parser, so that IDEs (in this case, Vim) can parse and do more advanced manipulation of Ada program text, such as extract-subprogram and rename-variable. But there ...
2
votes
2
answers
92
views
How can I start a process and convert its PID to/from an integer?
I'm writing a process manager in Ada, for Linux. I'm using GNAT.OS_Lib to spawn processes:
Pid := GNAT.OS_Lib.Non_Blocking_Spawn(
Program_Name => Program,
Args => Arguments
);
This gets ...
2
votes
1
answer
71
views
How can I serialize and deserialize a private type?
I'm working with the GNAT.OS_Lib module to implement a process manager for Linux. I'm using the subprograms in that module to spawn processes and get back PIDs, and now I want to save those PIDs to a ...
0
votes
0
answers
40
views
adding -gnatp flag to a file/package in GPS [duplicate]
I use Ada With GPS (GNAT Programming Studio). The flag "-gnatp" when building will ignore among others constraint errors.
I know a way to add the flag to all the files, using Edit->...
0
votes
5
answers
111
views
An array of records containing variable-length strings
I would like to have a record with an integer and a variable-length string in it, something like this:
type Entry is
record
Value: Integer;
Label: String;
end record;
I ran into the issue ...
4
votes
3
answers
178
views
SPARK Ada: Overlays Without Copying
I am trying to create a view of an array object to better utilise SIMD vectors on the x86_64 platform.
Here's the main idea:
type Char_Set_Index is range 0 .. 7;
type Char_Set_Element is mod 2 **...
0
votes
1
answer
112
views
Cannot run Gnat Studio
I'm trying to run Gnat Studio on Ubuntu 22.04 but I get the following error:
/opt/gnatstudio/bin/gnatstudio_exe: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No ...
0
votes
0
answers
86
views
Using Attribute Scalar_Storage_Order in ada with gcc 6.2.1
I'm currently trying to find a solution to control the storage order for elements within a record in ADA.
I'm using gcc 6.2.1 which doesnt recognize the Scalar_Storage_Order attribute ( even though ...
3
votes
0
answers
89
views
Purpose of Pragma Inline in specification files
Many subprogram declarations of GNAT Standard Library uses Pragma Inline in their specification files and I want to know how it work because other modules use only this specification during ...
1
vote
2
answers
141
views
What happens in Ada when memory is deallocated?
I'm totally new to Ada, and I have to learn it for a course I'm having in school.
One of the exercises I've done asks for a procedure to swap pointers' adresses, then to change a pointer's address to ...
1
vote
1
answer
73
views
private type extension and dispatching on private primitives in Ada
I'm trying to hide some aspects of a library to the users and reading the RM for type conversions, I can't understand why the following code fails.
A user will instantiate root.child.concrete....
1
vote
4
answers
100
views
Ada Gnat project which includes differently-named files for different build configurations
I have a Gnat/Gprbuild project with several build configurations. I have a main source file and an secondary ads file which the main source file includes:
with Secondary_File; use Secondary_File;
The ...
2
votes
1
answer
60
views
When does the parent thread synchronize with an ada task type variable with a non-global scope?
I was working on some multithreaded Ada network code, which involved accepting and handling multiple connections in parallel. An ideal situation for the use of Ada tasks, no? Specifically, multiple ...
0
votes
1
answer
93
views
in linux how to make a batch file executable from my ada program by spawning chmod 777 mem.bat
spawning a linux command line from an ada program
HI,
I need to spawn a linux command line from an ada program
the command line is chmod 777 mem.bat
(it makes mem.bat executable)
from the same ada ...
1
vote
2
answers
89
views
ranlib Error using Alire and GNAT with ASFML
i am learning how to use Alire using the Ada binding to SFML which is ASFML. So far I have downloaded
and installed ASFML using Alire and have successfully imported it into my test project. When I go ...
0
votes
0
answers
90
views
Ada test if directory exist in gpr file
I have a project.gpr used by 5 projects containing this :
MyProject_Source_Dirs :=
{
external ("HOME") & "/project2/src/**",
external ("HOME") & "/...
0
votes
1
answer
64
views
Expected private type
I have a compile-error that states: "expected private type "Pekare" defined at line 3. found an access type".
this is the .ads code:
package Image_Handling is
type Data_Access ...
0
votes
1
answer
44
views
gprbuild fails to include a file needed for gnatcoll
I tried to build something with GnatColl from GPS Community 2021 on Fedora 35. The linker failed, saying
ld: /path/to/common/Ada/Quoter/obj/gnatcoll-refcount.o: in function `...
1
vote
3
answers
151
views
obtaining a list of prime numbers in Ada
I have made a program for obtaining a list of prime numbers in ADA and using the following online compiler:
https://rextester.com/l/ada_online_compiler
My code is the following:
--GNAT 8.3.0
with ...
1
vote
2
answers
124
views
Idiomatic way to use data buffer with non-uniform byte skips in Ada
I'm trying to read from a byte buffer in Ada, such as a file or via buffer for a network connection. The messages are variable in size with a common header, in C++ it'd look something like this:
enum ...
0
votes
1
answer
82
views
How to Implement an Cronjob In Ada?
How to implement a Cron task in Ada ?
The precision of the Cron task can be 1 second; sub-seconds are not necessary.
with Ada.Text_IO;
With Ada.Calendar;
With Ada.Calendar.Formatting;
use Ada....
3
votes
1
answer
111
views
How to make GPR accept multiple sources in the same project having the same file name?
I set out to rewrite an OSS project in C piece by piece to Ada. First stop being to replace the build system with GPR. On doing so I stumbled upon a problem: it does not allow for multiple sources in ...
0
votes
0
answers
75
views
Program was killed (timeout reached) in Ada
I have an assignment in Ada to calculate VAT table; my code works good except when I will gave the following data:
Given data:
Firstprise: 1.0
lastprise: 2.0
step: 0.0
step: -0.1
step: 0.5
Procent: 50....
0
votes
1
answer
57
views
Print the last rad in while loop in Ada
I wrote a program in Ada that ask user to put startprise, stopppris,step and procent, the the program will calculate and print the result.
My code is good,I have no problem with it, I can print all ...
2
votes
2
answers
92
views
Do Ada 83 exceptions include resource cleanup?
Ada 83 was one of the first languages to have exceptions. (I want to say 'the first', but one thing I have learned from looking into the history of technology is that there is almost always an earlier ...
0
votes
1
answer
113
views
Explicit Register Variables in Ada
C allows you to create explicit register variables which force the compiler to store the variable in a specific register (not just any General Purpose Register):
register int *p2 asm ("r1") =...
3
votes
2
answers
95
views
Alire fails with error when building project
I am following the steps here https://pico-doc.synack.me/ to create a simple Ada program to flash a LED on the Raspberry Pi but have come across an issue when building with Alire.
Using the above ...
1
vote
1
answer
104
views
Add a button in a callback
I can't make my callback function work. I have created a button which when clicked removes the first button and displays the second button. When I click the button, it removes the first button but ...
1
vote
1
answer
167
views
Passing String from C to Ada via C Interpreter (VxWorks)
I'm trying to pass a string from C to Ada by using the C interpreter in a telnet window to a VxWorks box.
Interface.h
#pragma once
#ifdef _cplusplus
extern "C"
{
#endif
extern void ...