2,431 questions
0
votes
1
answer
29
views
Use switches in the .gpr file for Ada program in community compiler 25.0w
I am compiling a program with "Build & debug" and get the following error message:
[2024-12-12 11:24:45] Could not determine the project for file: D:\ada\project\Sudoku\Sudoku_main.gpr
[...
0
votes
2
answers
64
views
Does GNATCOLL.traces exist?
Whenever I look up logging in Ada, one of the recommendations is GNATCOLL.Traces. I can see the documentation for it but there is no code.
If I try something like
with GNATCOLL.Traces;
I get an ...
5
votes
1
answer
65
views
Cannot use `'First` and `'Last` on unbounded strings
When trying to get the first or last index of an unbounded string, as shown in this program
with Ada.Strings; use Ada.Strings; -- for `Backward`
with Ada.Strings.Unbounded;
with Ada.Text_IO; use Ada....
2
votes
1
answer
56
views
Speeding up alr build with gtk
Is there a way of speeding up an alr build with gtk? Say I start a new project.
alr init --bin a98xml
alr with gtk
That is simple enough.
alr build
This takes about 4 minutes. We only have to do ...
0
votes
1
answer
54
views
How to get the color from GtkAda?
the attached code compile & runs.
$ ./xml_code
Loading of XML is OK
(xml_code:31196): Gtk-CRITICAL **: 22:24:59.048: gtk_color_chooser_get_rgba: assertion 'GTK_IS_COLOR_CHOOSER (chooser)' failed
...
0
votes
0
answers
84
views
gprbuild: Shared libraries between multiple projects
I have a couple of executables that I want to be able to use the same libraries. After building, I want the tree to look like this (simplified example):
Root
|--Prog1
| |--src
| |--obj
| |--Prog1....
0
votes
1
answer
64
views
How to run a pre build script in gnat project file?
I have a mixed C++ and Ada project.
A GPRbuild project is used to build it and there is no makefile.
There is a script which creates an H file with constants such as build host, username and git ...
0
votes
1
answer
75
views
How do I implement putchar in C to support RTS?
I'm implementing a minimal Ada RTS for the esp32s3 SoC. Currently, I am stuck with an error that's proving resistant to every solution I've thrown at it. It claims putchar is undefined:
Link
[link] ...
0
votes
0
answers
45
views
how to get the gtkentry text?
I would like to know how you get the text of a gtkentry when you click on a button???because when i trying to get the text of the entry with a button it not work. here my code. I use Ada
file.ads
-- ...
0
votes
1
answer
70
views
How to switch off -gnatyt in alr
I've just installed alr on Linux. Haven't used ada for about 10 years and found that gnat community is no longer supported. Entered the following program
with Ada.Text_IO;
procedure A02hello is
...
0
votes
0
answers
80
views
Change background color with gtkada css
Hi everyone and sorry again for the inconvenience but since then I have created a window with gtkada to which I want to change the color of the background with css, but this is where things get ...
2
votes
1
answer
91
views
Dynamic Dispatching with Generic Packages in Ada
I am having trouble getting dynamic dispatching to work with Ada generics. Is there an elegant way (something better than conditions such as if X in A then ...) to have the generic Print procedure in ...
1
vote
1
answer
115
views
Adding wide character support breaks ncurses menu
I'm currently trying to create an ada program (this will be relevante later on) with a basic TUI.
To do so, I'm using ncurses, and more specifically, I'm interfacing with C as the ada bindings, ...
0
votes
0
answers
71
views
how to install gtkada on linux
i can't to install gtkada on my Linux PC. I tried look at the adacore's docs but I can't to understand. please someone can help me to install gtkada.i'm really blocked.
after to have download and ...
0
votes
0
answers
51
views
Adding hashmap elements to an unbounded_wide_string doesn't add it to the end
EDIT :
I'm... not too sure what I did, but I accidently solved my issue ?
While I was working on integrating comma support I decided to extract from the below function the conditions and put it in ...
2
votes
2
answers
129
views
How do I defer the full definition of a type?
Assume I have the following subprogram declared in the specification.
package Waiter is
type Time_Span is ????; -- Time_Span definition TBD...
procedure Wait (Period : Time_Span);
end Waiter;
...
2
votes
1
answer
113
views
Ada integer text guess error, how to fix?
So I was creating a guessing game for Ada but yeah it doesn't run. The error is in Line 25.
It says
guessing_game.adb:25:26: error: no candidate interpretations match the actuals:
with Ada.Text_IO;
...
1
vote
2
answers
200
views
Range check failed when using reduction expression in Ada
I tried to convert the array concatenation in function A to the new Ada 2022 reduction expression (see function B), but I get a range check failed error. What am I doing wrong?
with Ada.Text_IO;
...
2
votes
2
answers
108
views
How to iterate over a range with a custom step?
How can I iterate over a range in Ada with a custom step ?
For I in Integer'Range
loop
-- do something every 10 steps
end loop;
Can I define a subtype with specific step ?
1
vote
1
answer
92
views
Build the whitakers-words dictionary with Alire
First of all I want to apologize for something wrong I will say, I'm new to Ada and Alire.
I am trying to use the whitakers-words dictionary (https://github.com/mk270/whitakers-words) for a personal ...
2
votes
4
answers
227
views
How can I add an additional compiler option in an Alire .toml file?
For cross-compilation I need to specify the MCU type as a option to the Ada, C and theoretically C++ compiler.
How can I do that and in a way that it is also applied when building the dependencies?
At ...
5
votes
2
answers
137
views
Array of single bits in ada?
If I wrote
type u1 is range 0 .. 1;
type Index is range 0 .. 499999;
type U1Array is array(Index) of u1;
can I assume, that this will be a bit vector, which is packing the single u1 instances ...
3
votes
2
answers
130
views
Alias usage in Ada language
Package pack1 is
Type int_acc_type is access all integer;
End pack1;
--Local procedure
with pack1;
Procedure main is
Int_acc : pack1.int_acc_type;
Int_var : aliased integer;
Begin
Int_acc ...
0
votes
1
answer
149
views
How to avoid circular dependencies in Ada?
I have two packages called Passenger and Booking. They have a one to many relationship. I encountered a circular dependency error when I tried to do with in both of their files. I then tried limited ...
2
votes
2
answers
112
views
Subtype of string containing only hex characters in Ada
How can I define a subtype of String that allows only hex characters to be used? Here is my attempt, but I fail at the subtype definition:
subtype Hex_Character is Character
with Static_Predicate =&...
0
votes
0
answers
97
views
How to build SSL enabled for Ada Web Server?
I'm trying to get HTTPS requests working with Ada Web Server (AWS) found at https://github.com/AdaCore/aws/tree/master
I'm on Windows 11 and I don't understand how to make a build of the library and ...
1
vote
0
answers
140
views
How to do HTTPS requests in Ada Web Server?
I am trying to make HTTPS Get requests to websites in Ada web server. I can currently do HTTP requests without issues but HTTPS fails - possibly due to SSL Certificates. I am only using the client ...
1
vote
1
answer
82
views
What causes the syntax error in an Ada extension aggregate for a limited type? Commented out sectin gets the syntax error
The following code uses two different ways to create a record and initialize a value of that type. It's in package p3. The version that is commented out gets a syntax error which I don't understand. ...
4
votes
1
answer
160
views
Ada: Gnat Gprbuild Add a binary library with no .adb to a project
I have built a static library in Ada with Gnatstudio/Gprbuild. Now, I would like to use it in a executable project, but I only want to give .ads files and binary .a. No .adb.
My executable project gpr ...
5
votes
2
answers
145
views
Byte-wise iteration through an array in generic function in Ada
I have an array in a generic function where I want to iterate through it byte by byte. In the following example I am using Wide_Wide_Character's, so a character is 4 bytes long. With 3 given input ...
1
vote
1
answer
85
views
Cannot use SDL Ada Bindings on Ubuntu 22.04
Building sdlada is ok, via alr, is ok, but the running step fails ($ alr run).
sdlada_2.5.20_cd53c280$ alr run
ⓘ Running pre-build actions for sdlada=2.5.20...
make : on ...
0
votes
0
answers
58
views
gprbuild not binding GNATCOLL SQL program
I'm trying to get started with SQLite database programming in Ada, and gprbuild is failing to compile my program.
The output from gprbuild:
using project file database_test2.gpr
Bind
[gprbind] ...
1
vote
1
answer
145
views
Cannot build SDL Ada Bindings on OSX Sonoma because of error: missing binary operator before token "("
I am trying to write a small game using ADA (via Alire and gnat_native toolchain) and SDL2 on my OSX Sonoma 14.4.1.
For Ada I am using Alire and from what I can see I have latest gnat native version (...
1
vote
1
answer
128
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
107
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 ...
0
votes
0
answers
130
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
106
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
117
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 ...
4
votes
2
answers
104
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 ...
3
votes
1
answer
142
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 = ...
1
vote
0
answers
95
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; ...
2
votes
1
answer
85
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 ...
2
votes
1
answer
96
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
95
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
143
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
105
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
99
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 ...
0
votes
0
answers
79
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:...
0
votes
2
answers
712
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, ...
2
votes
1
answer
103
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 ...