From: ldries46 <bertus.dries@planet.nl>
Subject: Re: Hardware independent programming
Date: Tue, 30 Jun 2020 08:35:15 +0200 [thread overview]
Message-ID: <5efadd23$0$1239$e4fe514c@news.kpn.nl> (raw)
In-Reply-To: <5efadba5$0$1220$e4fe514c@news.kpn.nl>
This is how such a Package could look like:
with Ada.Environment_Variables; use Ada.Environment_Variables;
with Debugging; use Debugging;
package body Hardware is
function Operation_System return Unbounded_String is
OS : Unbounded_String := To_Unbounded_String("No System");
begin
if Exists("OS") then
OS := To_Unbounded_String(Value("OS"));
end if;
return OS;
end Operation_System;
function Resolution(Screen_nr : positive := 1) return
Screen_resolution is
Scr : Screen_resolution;
str : Unbounded_String;
Name : Unbounded_String;
begin
str := To_Unbounded_String(integer'image(Screen_nr));
while Slice(str, 1, 1) = " " loop
str := To_Unbounded_String(Slice(str, 2, Length(str)));
end loop;
Name := To_Unbounded_String("Screen_Width_") & str;
if Exists(To_String(Name)) then
Scr.width := integer'value(Value(To_String(Name)));
Print_Line(Name);
end if;
Name := To_Unbounded_String("Screen_Heigth_") & str;
if Exists(To_String(Name)) then
Scr.heigth := integer'value(Value(To_String(Name)));
Print_Line(Name);
end if;
return Scr;
end Resolution;
end Hardware;
next prev parent reply other threads:[~2020-06-30 6:35 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-29 4:42 Hardware independent programming ldries46
2020-06-29 9:07 ` Niklas Holsti
2020-06-29 12:22 ` alby.gamper
2020-06-29 14:11 ` Shark8
2020-06-30 6:28 ` ldries46
2020-06-30 6:35 ` ldries46 [this message]
2020-07-02 6:15 ` ldries46
2020-07-02 7:25 ` Dmitry A. Kazakov
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox