ada

Can anyone please tell me the use of pragma statements

怎甘沉沦 提交于 2019-12-02 11:48:06
问题 Can anyone please tell me the use of pragma in C and Ada, with some examples if possible. 回答1: There are three standard pragmas in C99: #pragma STDC FP_CONTRACT on-off-switch #pragma STDC FENV_ACCESS on-off-switch #pragma STDC CX_LIMITED_RANGE on-off-switch Where 'on-off-switch' is one of ON, OFF, DEFAULT. These can be used at compile time to modify the behaviour of the compiler in arcane ways (these ones are related to the C99 floating point behaviour). The standard reserves STDC for

Variadic Ada Functions

夙愿已清 提交于 2019-12-02 09:25:11
问题 I'm studying Ada because I am intrigued by the idea of strict type safety and programming contracts. The idea of "programming for forever" is nice. Anyway, the real question is whether or not Ada has variadic functions. A search on SO suggests that Ada doesn't, and the correct way to do this is with an unconstrained array whose length is determined at runtime. My question then, isn't how do you do it, but rather what is the convention for doing it correctly? Additionally, why is it that Ada

What is “Subtype mark required in this context” exactly?

为君一笑 提交于 2019-12-02 07:09:56
I get Subtype mark required in this context at (*) . What exactly is subtype mask and why is it complaining here? main.adb (*)Open_Route : Route(1..3) := (others => new Location(X=>1.0,Y=>1.0, id=>1)); -- Closed_Route : Route (Open_Route'First .. Open_Route'Last + 1); -- P1 : Population (1..2); Location.ads package spec type Location is record Id : Positive; X : Float; Y : Float; end record; type Location_Acess is access all Location; type Route is array (Positive range<>) of Location_Acess; type Route_Acess is access all Route; type Population is array (Positive range<>) of Route_Acess; A

Calling scanf from Ada

独自空忆成欢 提交于 2019-12-02 06:30:57
问题 How do you call scanf from Ada? That is, presumably with an appropriate pragma import declaration, but what would the declaration look like? (I'm interested in how to call C functions of the more unruly variety from Ada, not how to parse strings per se, so I'm not looking for a pure Ada solution. My setup is Gnat, Ubuntu Linux, x64 if it makes a difference.) 回答1: This paper points out that Ada has no way of declaring a function that takes different numbers of parameters of different types.

Ada: Understanding private types and understanding packaging

天涯浪子 提交于 2019-12-02 05:51:03
问题 I am trying to learn how to use private declarations in Ada and also to understand packaging. I have tried to keep my codes as short as possible. We start with the main file rectangular_Form.ads with Rectangular_Method_1; package Rectangular_Form renames Rectangular_Method_1; -- with Rectangular_Method_2; -- package Rectangular_Form renames Rectangular_Method_2; This tells us that we can have two implementations and that for now Rectangular_Method_1 has been chosen. Then we have the

What is the point of renaming Types in Ada

拜拜、爱过 提交于 2019-12-02 05:40:47
问题 In Ada, I have commonly seen something like this: type Number is new Integer; What is the point of this? Can't you just be happy with an Integer ? I have also seen code such as: type Small_Number is range 1..5; This makes sense to me; I can see why this would be useful. But why, in any case would you choose to use the former example? 回答1: More commonly I have seen code like this: Type Pounds is new Integer; Type Euros is new Integer; Type Dollars is new Integer; This means that you are not

What is the Ada command line redirector that is analogous to “>”?

坚强是说给别人听的谎言 提交于 2019-12-02 04:34:19
Ada noob here (and also not so hot with the command line in general). I am looking for the Ada command line redirector that would be analogous to ">" in DOS. I am running an Ada application in a command line shell. (William Whitaker's WORDS, if that is helpful). I use the "@" command to get the WORDS application to read the list of terms from a text file. I want the output to be written to a file, not to just appear in the command shell. I did look at http://www.ada-auth.org/standards/12rm/html/RM-A-15.html but didn't see anything for redirect*. Also helpful to know would be whether the ADA

Ada compiler crashes with “Ada compiler not installed on this system.” after downgrading gcc version

戏子无情 提交于 2019-12-02 04:01:55
问题 I downgraded my gcc version 4.6.3 to 4.3.4 but ada version is not changed gnat-4.6.3 so I got error Ada compiler not installed on this system. How to set my ada to gnat 4.3.4? 回答1: It depends on what system you're running on and how you installed it. You need to either install GNAT from the same build of GCC, or you need to install GNAT in such a way that it doesn't interfere with the rest of GCC. 来源: https://stackoverflow.com/questions/11538813/ada-compiler-crashes-with-ada-compiler-not

How to use GTK+ with ada

爷,独闯天下 提交于 2019-12-02 02:44:35
Anyone can show me some examples, simple, how to use GTK with Ada? examples, like: How to use Glade with Ada, create an simple window.... an simple window, like this: #include <gtk/gtk.h> int main(int argc, char *argv[] ) { GtkWidget *window; gtk_init (&argc, &argv); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_widget_show (window); gtk_main (); return 0; } And, It's possible to use GtkMM, with ada ? Thanks... A few of my favorite GtkAda programs: Animation demo Linxtris Mine Detector Also, don't overlook the examples and testgtk folders of GtkAda itself. Additional resources: GTK+ API

Troubles compiling in GPS (Ada IDE) with glib.h

我是研究僧i 提交于 2019-12-02 00:57:55
i'm having some troubles when trying to compile Ada code in GPS. GPS says is missing when I include it on a package. I tried installing with apt-get, and it does, but the error is still there. What can I do next? I'm running GPS on a x64 Ubuntu 12.04. Here's the error message I got: gprbuild -d -P/media/LUISMUNYOZ/QUINTO/str/pendulum/pendulum_portatil/pendulum.gpr -XEXTRA=True -XOPENGL=True -XGNOME=True -XBUILD=Production print_barrier_sync.adb contrib.gpr:1:09: warning: no compiler specified for language "Xml", ignoring all its sources x86_64-pc-linux-gnu-gcc -c lw.c In file included from