ada

Storing and using strings of varying length (ADA)

蓝咒 提交于 2021-02-19 05:06:50
问题 Im working on a problem where I need to make a set of boxes according to an input number where each and every box has a unique name. I've managed to create the boxes but I've only managed to insert one name on all of them as my names are overwritten in the name collecting procedure. here is the code https://pastebin.com/FBMvvrn4 with Ada.Text_IO; use Ada.Text_IO; with Ada.Float_Text_IO; use Ada.Float_Text_IO; with Ada.Integer_Text_IO; use Ada.Integer_Text_IO; procedure exercise is N : Integer

Dining Philosopher problem Ada- Implementing ID Dispenser

こ雲淡風輕ζ 提交于 2021-02-11 06:22:19
问题 I have the following code, related to the dining philosopher problem. I am very new to Ada so am not sure about how to implement the Id_Dispenser package. with Ada.Text_IO; use Ada.Text_IO; with Id_Dispenser; with Semaphores; use Semaphores; procedure Philos is No_of_Philos : constant Positive := 5; -- Number of philosophers Meditation : constant Duration := 0.0; type Table_Ix is mod No_of_Philos; Forks : array (Table_Ix) of Binary_Semaphore (Initially_Available => True); package Index

How to take care of the Index Error when using STRING_SPLIT?

拜拜、爱过 提交于 2021-02-10 20:52:31
问题 raised GNAT.STRING_SPLIT.INDEX_ERROR I have try taking care of using the index error with https://marc.info/?l=gcc-patches&m=139022610224587&w=2 . However, How can it read the next line. Ada doesn't seem it has something similar to nextLine(); like in java. with Ada.Text_IO; use Ada.Text_IO; with GNAT.String_Split; use GNAT.String_Split; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; procedure TextFile is File : File_Type; Tokens : Slice_Set; Index : Slice_Number; type Payrate_Type is

How to take care of the Index Error when using STRING_SPLIT?

南笙酒味 提交于 2021-02-10 20:50:17
问题 raised GNAT.STRING_SPLIT.INDEX_ERROR I have try taking care of using the index error with https://marc.info/?l=gcc-patches&m=139022610224587&w=2 . However, How can it read the next line. Ada doesn't seem it has something similar to nextLine(); like in java. with Ada.Text_IO; use Ada.Text_IO; with GNAT.String_Split; use GNAT.String_Split; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; procedure TextFile is File : File_Type; Tokens : Slice_Set; Index : Slice_Number; type Payrate_Type is

Spark-Ada postcondition for array total

痞子三分冷 提交于 2021-02-10 05:52:30
问题 How does one write a Spark postcondition for a function that sums the elements of an array? (Spark 2014, but if someone shows me how to do it for an earlier Spark I should be able to adapt it.) So if I have: type Positive_Array is array (Positive range <>) of Positive; function Array_Total(The_Array: Positive_Array) return Positive with Post => Array_Total'Return = -- What goes here? is -- and so on I don't need to worry about overflow in my particular case (I know what the total was at

How can I specify functions or procedures GNATTest should auomatically generate a test case for

徘徊边缘 提交于 2021-02-09 00:47:33
问题 I'm working on a huge code package (written dominantly in ada), which is an extreme mess. No Unit Tests are applied so far and for all the existing code, Unit tests must not be implemented. But our Team decided, that all the new code should be implemented together with tests. Within GPS there is the possibility to let GNATtest automatically generate test procedures for all functions and procedures in the project. But as written, we have to exclude all of the old code from this automated

How can I specify functions or procedures GNATTest should auomatically generate a test case for

五迷三道 提交于 2021-02-09 00:46:33
问题 I'm working on a huge code package (written dominantly in ada), which is an extreme mess. No Unit Tests are applied so far and for all the existing code, Unit tests must not be implemented. But our Team decided, that all the new code should be implemented together with tests. Within GPS there is the possibility to let GNATtest automatically generate test procedures for all functions and procedures in the project. But as written, we have to exclude all of the old code from this automated

Is it possible to force a range of virtual addresses?

自古美人都是妖i 提交于 2021-02-07 09:22:04
问题 I have an Ada program that was written for a specific (embedded, multi-processor, 32-bit) architecture. I'm attempting to use this same code in a simulation on 64-bit RHEL as a shared object (since there are multiple versions and I have a requirement to choose a version at runtime). The problem I'm having is that there are several places in the code where the people who wrote it (not me...) have used Unchecked_Conversions to convert System.Addresses to 32-bit integers. Not only that, but

Is it possible to force a range of virtual addresses?

柔情痞子 提交于 2021-02-07 09:21:02
问题 I have an Ada program that was written for a specific (embedded, multi-processor, 32-bit) architecture. I'm attempting to use this same code in a simulation on 64-bit RHEL as a shared object (since there are multiple versions and I have a requirement to choose a version at runtime). The problem I'm having is that there are several places in the code where the people who wrote it (not me...) have used Unchecked_Conversions to convert System.Addresses to 32-bit integers. Not only that, but

Best practices to determine stack usage in Ravenscar program

余生颓废 提交于 2021-02-07 06:26:07
问题 I am writing an Ada program using the Ravenscar subset (thus, I am aware of the number of running tasks at execution time). The code is compiled by gcc with the -fstack-check switch enabled. This should cause the program raise a STORAGE_ERROR at runtime if any of my tasks exceed their stack. Ada allows to set the upper limit for those (task-specific) stacks during the specification of the respective task like so: pragma Storage_Size (Some_Value); Now I was wondering what options I have to