Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using .net commands in Ada

Tags:

.net

ada

gnat

I know, it's a noob question but..... I don't know :(

I am using dotnet-gnat, I'm having trouble using the commands of the platform. Net in Ada ... I can use the WriteLine, but the ReadLine command, I can not .... How to know the correct way to use some command?

My code:

with Ada.Text_IO, MSSyst.Console;
use  Ada.Text_IO, MSSyst.Console;

procedure ada_net is
begin
    Put("Ola mundo");
    New_line;
    WriteLine("Ola mundo");
    --ReadLine;
end ada_net;

ReadLine code:

function ReadLine  return access MSSyst.String.Typ'Class;
pragma Export (CIL, ReadLine, "ReadLine");

Thanks.

like image 305
Alexandre Avatar asked Dec 01 '25 21:12

Alexandre


1 Answers

with
MSSyst.String,
MSSyst.Console,
Ada.Text_IO;

procedure Test is
begin
   Ada.Text_IO.Put_Line( "Dotnet test." );
   Ada.Text_IO.Put( "Enter a line: " );
   declare
      Line : access MSSyst.String.Typ'Class renames MSSyst.Console.ReadLine; --'

      use MSSyst.String;
      Function "&"( Left, Right : access Typ'Class ) return access Typ'Class renames Concat;
      Function "&"( Left : String; Right : access Typ'Class ) return access Typ'Class is
        ( (+Left) & Right );
   begin      
      MSSyst.Console.WriteLine( ("You entered: """ & Line) & (+(1=> '"')));
   end;
end Test;
like image 63
Shark8 Avatar answered Dec 03 '25 09:12

Shark8



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!