ada

Newline while writing a text file in Ada

淺唱寂寞╮ 提交于 2019-12-12 05:05:22
问题 I am opening a text file in Ada with the following code: Open (File => out_parcial_variante1, Name => "c.txt", Mode => append_file); put(File => out_parcial_variante1, Item=> "r"); close(out_parcial_variante1); The file as a structure like this inside: 01 #510.00:1003.00,512.04:1110.00,515.00:998.00,-98.00,-100.00 <second empty line, this text is not in the file> Note that besides the initial line the cursor is in a second line there with nothing written. Whenever my code writes in the file,

Ada: throwing wrong exception when opening a non-existent file

一世执手 提交于 2019-12-12 04:04:02
问题 This is a follow up of this [post] Ada: Adding an exception in a separate procedure when reading a file When my code below opens a file that doesn't exist, instead of throwing a ADA.IO_EXCEPTIONS.NAME_ERROR , it is throwing a ADA.IO_EXCEPTIONS.STATUS_ERROR . Below are the codes. Main file: test_read.adb : with Ada.Text_IO; use Ada.Text_IO; with Ada.Long_Float_Text_IO; with Ada.Float_Text_IO; procedure Test_Read is Input_File : File_Type; value : Long_Float; procedure Open_Data (File : in out

GtkAda simple chat error

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-12 03:23:30
问题 I'm writing simple chat program in Ada, and I'm having problem with chat window simulation - on button clicked it reads text form entry and puts it on text_view. Here is the code I've written and here is the compile output: gnatmake client `gtkada-config` gcc -c -I/usr/include/gtkada client_pkg.adb client_pkg.adb:14:19: no candidate interpretations match the actuals: client_pkg.adb:14:37: expected private type "Gtk_Text_Iter" defined at gtk-text_iter.ads:48 client_pkg.adb:14:37: found type

Chat window with Gtk+

痞子三分冷 提交于 2019-12-12 03:03:46
问题 I'm writing some sort of chat in Ada using Gtk+ (technically GtkAda ). And I have of problem with some Gtk . My window consists of an Entry , TextView and Button ("Send"). The hard part is in handler On_Button_Send_Clicked (procedure that deals with signal 'clicked' on button). I want to read text form Entry and place it in TextView , but how can I access TextView and Entry from a procedure that has only access to Button , as I connect the signal with a handler in this way: package Handlers

Ada types size difference

依然范特西╮ 提交于 2019-12-12 01:09:39
问题 I have this Ada program: with Ada.Text_IO, Ada.Integer_Text_IO; use Ada.Text_IO, Ada.Integer_Text_IO; procedure test is type MY_TYPE is new Integer range 1..20; subtype MY_TYPE2 is MY_TYPE range 5..6; c : MY_TYPE:=10; f : MY_TYPE2 :=6; begin put(Integer(c'SIZE)); end test; and when I run it I get 32. If I replace type MY_TYPE is new Integer range 1..20; with type MY_TYPE is range 1..20; I get 8. What is the difference between the two declarations? 回答1: You are allowing the compiler to choose

Overriding and Type Extension

ぃ、小莉子 提交于 2019-12-12 01:05:46
问题 Just hoping someone can explain why my program is defaulting to the Move_Piece procedure for the Piece Type, and not the Move_Piece procedure for the Pond type when I attempt to move a pond. When I pass a variable of Pond type to the Move_Piece procedure, "Using basic Move_Piece" gets printed instead of "1". Why is this? I am using Ada 2005, in case that wasnt obvious by the overriding keyword. I hope I have not provided too little of information. Thanks! chess_types.ads: package Chess_Types

gnatbind: Cannot find: s-stalib.ali

僤鯓⒐⒋嵵緔 提交于 2019-12-11 20:22:25
问题 I installed GNAT on my OS X 10.8.5 machine with the following steps: Download GNAT GPL from http://libre.adacore.com/download/configurations Install with ./doinstall , accepting all the default options Added /usr/local/gnat/bin to $PATH After trying to compile a simple hello world example I get this error: $ gnat make hello gcc -c hello.adb gnatbind -x hello.ali gnatbind: Cannot find: s-stalib.ali gnatmake: *** bind failed. Any idea why this might happen? PS: gnat make -a hello works, but

Reading Keyboard Input using AdaGtk

戏子无情 提交于 2019-12-11 18:48:56
问题 I am using Ada together with the Gtk library. I would like to read the user's keyboard input and react individually on it, depending which keys he/she pressed. How can I access the keyboard input from the user? 回答1: I'm not sure what you're looking for: 1) keystrokes or 2) editable text. The game LinXtris handles main window key_press_event signals in the procedure On_Main_Window_Key_Pressed, which passes each Gdk.Event.Gdk_Event_Key on to the Game_Engine . The Interaction demo cited here has

i am trying to implement a pair of AWS servers that use SSL to create self-signed certificates to communicate some data between them

我的梦境 提交于 2019-12-11 15:48:39
问题 i am able to create a hello world sample program which simply communicating using AWS servers. but now i am trying to use self signed certificates for communication over secure RSA 2048 connection. Can someone guide me how i can create self signed certificates in Ada and use it with in my server program. ------------------------------------------------------------------------------ -- Ada Web Server ------------------------------------------------------------------------------ Com_1.adb --

Problem with ADA file executed by a c++(UsrAppInit) in VXWorks 6.7(workspace-4)?

杀马特。学长 韩版系。学妹 提交于 2019-12-11 15:38:30
问题 I have a file build and compiled correctly in ADA (a simple Hello world). I want to execute the file .o from a c++ using taskspawn. To do that I have read that you must declare in the c++ something like that: ... #include <taskLib.h> /* Ada binder-generated main - ADA_MAIN is passed as a macro from the makefile */ extern void ADA_MAIN(void); void UsrAppInit() { int stackSize = 0x80000; int spawnFlags = VX_FP_TASK; /* MAIN_TASK_NAME is passed as a macro from the makefile */ char * mainTaskName