ada

Enum in C++ like Enum in Ada?

大城市里の小女人 提交于 2019-11-27 20:57:26
At one point I had looked at implementing a class/template in C++ that would support an Enum that would behave like it does in Ada. It has been some time since I thought about this problem and I was wondering if anyone has ever solved this problem? EDIT: My apologies, I should clarify what functionality I thought were useful in the Ada implementation of the Enum. Given the enumeration type fruit is (apple, banana, cherry, peach, grape); We know that fruit is one of the listed fruits: apple, banana, cherry, peach, grape. Nothing really different there from C++. What is very useful are the

The use of IN OUT in Ada

99封情书 提交于 2019-11-27 15:54:20
问题 Given below is some code in ada with TYPE_VECT_B; use TYPE_VECT_B; Package TEST01 is procedure TEST01 ( In_State : IN VECT_B ; Out_State : IN OUT VECT_B ); function TEST02 ( In_State : IN VECT_B ) return Boolean ; end TEST01; The TYPE_VECT_B package specification and body is also defined below Package TYPE_VECT_B is type VECT_B is array (INTEGER range <>) OF BOOLEAN ; rounded_data : float ; count : integer ; trace : integer ; end TYPE_VECT_B; Package BODY TYPE_VECT_B is begin null; end TYPE

Interface Ada dynamic Library with Java using JNA and Ada's Interface.C packages

删除回忆录丶 提交于 2019-11-27 08:28:56
问题 I have to write a DLL is supposed to provide a simple service that takes: IN a string or byte array (equivalent of char*) IN integer expliciting the size of the in char* IN equivalent of char* buffer used by library to write data in IN size of the available char* buffer for writing OUT effetive written size into the out char* buffer Using a C point of view, the signature should look like: void myService (char* inBuffer, // as in string int anInteger, // as in param char* outBuffer, // used as

GDB errors on macOS Mojave

╄→гoц情女王★ 提交于 2019-11-27 04:48:32
问题 Environment: Mac/Mojave and GDB 8.2.1 (via homebrew). I worked through instructions https://forward-in-code.blogspot.com/2018/11/mojave-vs-gdb.html i.e.: latest GDB via brew, which solves the executable format issue sign GDB with new entitlements Additionally, I've also modified SIP to allow debugging (in Recovery OS terminal: csrutil enable --without debug ). However, I still can’t get gdb to work: (gdb) file main Reading symbols from main...done. (gdb) run Starting program: /Users

Stuck on an Ada Program - Stuck on Input

前提是你 提交于 2019-11-26 18:38:07
问题 I have a pretty simple Ada project on my hands. The task is to take a collection of a "voter's" votes and compare it to each "candidate's" score and determine which candidate best matches the voter. The input looks like this, followed by the output that should be put out: Input: 0 0 0 1 1 1 -1 -1 -1 1 7 A 1 1 1 1 1 1 1 1 1 1 B -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 C 1 -1 1 -1 1 -1 1 -1 1 -1 D 1 0 1 0 1 0 1 0 1 0 E 0 -1 0 -1 0 -1 0 -1 0 -1 F 1 1 1 1 0 0 0 0 0 0 G 0 0 0 1 -1 0 0 -1 1 1 Output: A F G So