mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-22 00:41:55 +00:00
Support GNAT.IO in Ada programs
This commit is contained in:
committed by
Norman Feske
parent
119a12cba5
commit
14cd115c82
36
repos/libports/src/test/gnatio/main.adb
Normal file
36
repos/libports/src/test/gnatio/main.adb
Normal file
@ -0,0 +1,36 @@
|
||||
--
|
||||
-- \brief GNAT.IO test program
|
||||
-- \author Alexander Senier
|
||||
-- \date 2019-01-03
|
||||
--
|
||||
|
||||
with GNAT.IO;
|
||||
|
||||
procedure Main is
|
||||
use GNAT.IO;
|
||||
begin
|
||||
Put (Standard_Output, "Hell");
|
||||
Put (Standard_Output, 'o');
|
||||
Put_Line (Standard_Output, " World!");
|
||||
New_Line (Standard_Output);
|
||||
Put (Standard_Output, 98765432);
|
||||
New_Line;
|
||||
|
||||
Put ("Integer: ");
|
||||
Put (123456);
|
||||
New_Line;
|
||||
|
||||
Put_Line ("Character: ");
|
||||
Put ('X');
|
||||
Put ('Y');
|
||||
Put ('Z');
|
||||
New_Line;
|
||||
|
||||
Put ("New_Line with spacing:");
|
||||
New_Line (Spacing => 5);
|
||||
|
||||
Set_Output (Standard_Error);
|
||||
Put (11223344);
|
||||
New_Line;
|
||||
Put_Line ("GNAT.IO test program started successfully.");
|
||||
end Main;
|
23
repos/libports/src/test/gnatio/startup.cc
Normal file
23
repos/libports/src/test/gnatio/startup.cc
Normal file
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* \brief Wrapper for Ada main program using Terminal session
|
||||
* \author Alexander Senier
|
||||
* \date 2019-01-03
|
||||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/component.h>
|
||||
#include <terminal_session/connection.h>
|
||||
|
||||
extern "C" void _ada_main(void);
|
||||
|
||||
/* Required in runtime */
|
||||
Terminal::Connection *__genode_terminal;
|
||||
|
||||
void Component::construct(Genode::Env &env)
|
||||
{
|
||||
Terminal::Connection _terminal (env, "Ada");
|
||||
__genode_terminal = &_terminal;
|
||||
|
||||
_ada_main();
|
||||
env.parent().exit(0);
|
||||
}
|
4
repos/libports/src/test/gnatio/target.mk
Normal file
4
repos/libports/src/test/gnatio/target.mk
Normal file
@ -0,0 +1,4 @@
|
||||
TARGET = test-gnatio
|
||||
SRC_ADB = main.adb
|
||||
SRC_CC = startup.cc
|
||||
LIBS = base ada
|
Reference in New Issue
Block a user