ada

Ada: how to solve “Circular Unit Dependency”?

不打扰是莪最后的温柔 提交于 2019-12-12 13:48:38
问题 Suppose I have two records: Person and Animal . Each record is in a separate package. Package persons: with animals; use animals; package persons is type person is record ... animalref: animalPOINTER; ... end record; type personPOINTER is access person; end persons; Package animals: with persons; use persons; package animals is type animal is record ... ownerref: personPOINTER; ... end record; type animalPOINTER is access animal; end animals; I have Circular Unit Dependency here, and compiler

How to stop console window from closing immediately | GNAT - GPS

左心房为你撑大大i 提交于 2019-12-12 13:27:57
问题 I have Ada program that runs and compile perfectly using GNAT - GPS. When I run its exe file and provide user input then instead of saying "Press any key to continue", the exe closes immediately. I have searched for it online alot but i only found info related to c/c++/visual studio console window using system('pause'); OR Console.Readline(). Is there any way around for this in Ada lanaguage? 回答1: Apart from using Get_Line or Get , you can also use Get_Immediate from the Ada.Text_IO package.

Preventing mangled names in Ada DLL

北城余情 提交于 2019-12-12 13:10:45
问题 Is there a simple way to prevent Ada names from getting mangled when creating an Ada DLL? Here is my .adb code with Ada.Text_IO; package body testDLL is procedure Print_Call is begin Ada.Text_IO.Put_Line("Hello World"); end Print_Call; function Add_Nums(A,B : in Integer) return Integer is begin return A + B; end Add_Nums; end testDLL; my .ads package testDLL is procedure Print_Call; pragma export (dll, Print_Call, "Print_Call"); function Add_Nums(A,B : in Integer) return Integer; pragma

Exception Handling in Ada during Unit Test

空扰寡人 提交于 2019-12-12 13:08:59
问题 I am attempting to write some unit tests for some Ada code I recently wrote, I have a particular case where I am expecting to get an Exception (if the code worked correctly I wouldn't but in this case all I'm doing is testing, not writing code). If I handle the exception in the Testing routine then I don't see how I can continue testing in that procedure. I.E. (This is very much an example and NOT compilable code) procedure Test_Function is begin from -20 to 20 Result := SQRT(i); if Result =

Software engineering with Ada: stubs; separate and compilation units [closed]

断了今生、忘了曾经 提交于 2019-12-12 12:15:37
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 years ago . I'm with a mechanical engineering background but I'm interested to learn good software engineering practice with Ada. I have a few queries. Q1. If I understand correctly then someone can just write a package specification (ads) file, compile it and then compile the main program

Ada program works in Linux but not in GPS Windows 10

不羁岁月 提交于 2019-12-12 12:07:30
问题 Thanks in advance for any help. I am currently doing some beginner work on ada programming and I have installed GNAT Programming Studio (GPS) from http://libre.adacore.com/download/configurations# I have Windows 10 64-bits. I was given the following code at school: pragma Task_Dispatching_Policy(FIFO_Within_Priorities); with Ada.Text_IO; use Ada.Text_IO; with Ada.Real_Time; use Ada.Real_Time; procedure PeriodicTasks is Start : Time; package Duration_IO is new Ada.Text_IO.Fixed_IO(Duration);

Ada: objects with variable-sized array attribute

蹲街弑〆低调 提交于 2019-12-12 11:46:15
问题 I want to create a tagged type inside a package that describes a 2D discrete space, with a size determined in running time. (context : implementation of a game of life) First way I found was genericity : generic Size : Natural; package Worlds is type World_Type is tagged private; type World is access World_Type'Class; subtype Coordinate is Positive range 1..Size; private type World_Array is array (Coordinate, Coordinate) of Boolean; type World_Type is tagged record Content : World_Array; end

AI library framework in Ada

不羁的心 提交于 2019-12-12 09:50:59
问题 I'm looking for an Ada constructed framework for AI. I think Ada would be perfect for implementing temporal and stochastic paradigms due to its tasking and real-time mechanisms, but did not find anyone who tried to make such a libraries. Actually I did not find strong implementations on other languages too. For C# I found http://www.c-sharpcorner.com/1/56/, and for C++ I found http://mind.sourceforge.net/cpp.html but both did not get much popularity. Maybe java has good AI libraries too, but

Bitwise Operations in Ada

…衆ロ難τιáo~ 提交于 2019-12-12 09:04:23
问题 Is there a tutorial somewhere that explains on which datatypes bitwise operations can be used? I don't know why Lady Ada thinks that I cannot bitwise OR two Standard.Integer... $ gnatmake test.adb gcc -c test.adb test.adb:50:77: there is no applicable operator "Or" for type "Standard.Integer" gnatmake: "test.adb" compilation error Really? I excused the compiler for not being able to AND/OR enumerated data types. I excused the compiler for not being able to perform bitwise operations on

Why are there no (augmented assignment) operators like +=, -= or ++ in Ada? [closed]

人走茶凉 提交于 2019-12-12 07:19:04
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 6 years ago . I'm wondering why there are no operators like += , -= , ++ , -= , <<= or x ? y : z (not an augmented assignment ...) in Ada? Many