------------------------------------------------------------------------------ pragma optimize(From_Ada_Time); pragma Precondition(Push, not Is_Full(S)); --obsolete pragma Postcondition(Push, not Is_Empty(S)); --obsolete pragma Restrictions(No_Unchecked_Deallocation, No_Obsolescent_Features); procedure Push(S: in out Stack; X: in Item) with Pre => not Is_Full(S), Post => not Is_Empty(S); procedure Do_It( ... ) with Inline; Test_string : String := ""; Test_string : String := "a"; Test_string : String := """"; Test_string : String := "abc"; Test_string : String = "a""c"; Test_char : Character := '*'; Test_char : Character := '''; subtype C is character; Test_char : String := C'(')')'Img; a := toto'address; type myAddress : Address; with Address => 16#0000_FFFF#; with All_Calls_Remote => 16#0000_FFFF#; type myAddress : Address; a := toto'Adjacent; Byte : constant := 8; Page : constant := 2**12; type Medium is range 0 .. 65_000; for Medium'Size use 2*Byte; for Medium'Alignment use 2; Device_Register : Medium; for Device_Register'Size use Medium'Size; for Device_Register'Address use System.Storage_Elements.To_Address(16#FFFF_0020#); A <> B /= C <= D >= E << F >> CPU_Identifier : constant String(1..8) with Import => True, Convention => Assembler, Link_Name => "CPU_ID"; type Short is delta 0.01 range -100.0 .. 100.0; for Short'Size use 15; for Car_Name'Storage_Size use -- specify access type's storage pool size 2000*((Car'Size/System.Storage_Unit) +1); -- approximately 2000 cars function My_Input(Stream : not null access Ada.Streams.Root_Stream_Type'Class) return T; for T'Input use My_Input; -- see 13.13.2 i : based_numeral := 16#123_aBc_789#; j : based_numeral := 16#123_aBc_789#E23; k : based_numeral := 16#123_aBc_789#E+23; l : based_numeral := 16#123_aB.c_789#E-23; k : decimal_numeral := 1.4142; k : decimal_numeral := 1.4142E3; k : decimal_numeral := 1.4142E+3; k : decimal_numeral := 1.4142E-3; i : based_numeral := 16#123789# ; myException : exception; raise myException; raise Communication_Error; pragma page; ------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2013, Vadim Godunko mailto:vgodunko@gmail.com -- -- All rights reserved. -- ------------------------------------------------------------------------------ -- $Revision: 3957 $ $Date: 2013-06-30 13:14:44 +0400 (Sun, 30 Jun 2013) $ ------------------------------------------------------------------------------ with Ada.Calendar.Time_Zones; with League.Calendars.ISO_8601; package body League.Calendars.Ada_Conversions is ------------------- -- From_Ada_Time -- ------------------- function From_Ada_Time (Item : Ada.Calendar.Time) return Date_Time is use type Ada.Calendar.Time; Offset : constant Ada.Calendar.Time_Zones.Time_Offset := Ada.Calendar.Time_Zones.UTC_Time_Offset (Item); UTC : constant Ada.Calendar.Time := Item - Duration (Offset) * 60.0; -- XXX Must be reviewed after implementation of timezone support. -- Ada.Calendar.Time is local time and time zone conversion will be -- applied automatically by League.Calendars.ISO_8601.Create. Year : Ada.Calendar.Year_Number; Month : Ada.Calendar.Month_Number; Day : Ada.Calendar.Day_Number; Seconds : Ada.Calendar.Day_Duration; Whole_Seconds : Integer; Hour : League.Calendars.ISO_8601.Hour_Number; Minute : League.Calendars.ISO_8601.Minute_Number; Second : League.Calendars.ISO_8601.Second_Number; Fraction : League.Calendars.ISO_8601.Nanosecond_100_Number; begin Ada.Calendar.Split (UTC, Year, Month, Day, Seconds); Whole_Seconds := Integer (Seconds - 0.5); -- Conversion to integer uses mathematical rounding, so we need to -- subtract by 0.5 to extract whole number of seconds. Hour := League.Calendars.ISO_8601.Hour_Number (Whole_Seconds / 3_600); Minute := League.Calendars.ISO_8601.Minute_Number ((Whole_Seconds / 60) mod 60); Second := League.Calendars.ISO_8601.Second_Number (Whole_Seconds mod 60); Fraction := League.Calendars.ISO_8601.Nanosecond_100_Number ((Seconds - Ada.Calendar.Day_Duration (Whole_Seconds)) * 10_000_000); if false then raise myException; end if; return League.Calendars.ISO_8601.Create (League.Calendars.ISO_8601.Year_Number (Year), League.Calendars.ISO_8601.Month_Number (Month), League.Calendars.ISO_8601.Day_Number (Day), Hour, Minute, Second, Fraction); end From_Ada_Time; end League.Calendars.Ada_Conversions;