OSDN Git Service

* gcc-interface/misc.c (gnat_expand_expr): Remove.
[pf3gnuchains/gcc-fork.git] / gcc / ada / s-osprim.ads
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                 GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS                 --
4 --                                                                          --
5 --                  S Y S T E M . O S _ P R I M I T I V E S                 --
6 --                                                                          --
7 --                                  S p e c                                 --
8 --                                                                          --
9 --          Copyright (C) 1998-2009, Free Software Foundation, Inc.         --
10 --                                                                          --
11 -- GNARL is free software; you can  redistribute it  and/or modify it under --
12 -- terms of the  GNU General Public License as published  by the Free Soft- --
13 -- ware  Foundation;  either version 3,  or (at your option) any later ver- --
14 -- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
17 --                                                                          --
18 -- As a special exception under Section 7 of GPL version 3, you are granted --
19 -- additional permissions described in the GCC Runtime Library Exception,   --
20 -- version 3.1, as published by the Free Software Foundation.               --
21 --                                                                          --
22 -- You should have received a copy of the GNU General Public License and    --
23 -- a copy of the GCC Runtime Library Exception along with this program;     --
24 -- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
25 -- <http://www.gnu.org/licenses/>.                                          --
26 --                                                                          --
27 -- GNARL was developed by the GNARL team at Florida State University.       --
28 -- Extensive contributions were provided by Ada Core Technologies, Inc.     --
29 --                                                                          --
30 ------------------------------------------------------------------------------
31
32 --  This package provides low level primitives used to implement clock and
33 --  delays in non tasking applications.
34
35 --  The choice of the real clock/delay implementation (depending on whether
36 --  tasking is involved or not) is done via soft links (see s-soflin.ads)
37
38 --  NEVER add any dependency to tasking packages here
39
40 package System.OS_Primitives is
41    pragma Preelaborate;
42
43    Max_Sensible_Delay : constant Duration :=
44                           Duration'Min (183 * 24 * 60 * 60.0,
45                                         Duration'Last);
46    --  Max of half a year delay, needed to prevent exceptions for large delay
47    --  values. It seems unlikely that any test will notice this restriction,
48    --  except in the case of applications setting the clock at run time (see
49    --  s-tastim.adb). Also note that a larger value might cause problems (e.g
50    --  overflow, or more likely OS limitation in the primitives used). In the
51    --  case where half a year is too long (which occurs in high integrity mode
52    --  with 32-bit words, and possibly on some specific ports of GNAT),
53    --  Duration'Last is used instead.
54
55    procedure Initialize;
56    --  Initialize global settings related to this package. This procedure
57    --  should be called before any other subprograms in this package. Note
58    --  that this procedure can be called several times.
59
60    function Clock return Duration;
61    pragma Inline (Clock);
62    --  Returns "absolute" time, represented as an offset relative to "the
63    --  Epoch", which is Jan 1, 1970 00:00:00 UTC on UNIX systems. This
64    --  implementation is affected by system's clock changes.
65
66    function Monotonic_Clock return Duration;
67    pragma Inline (Monotonic_Clock);
68    --  Returns "absolute" time, represented as an offset relative to "the Unix
69    --  Epoch", which is Jan 1, 1970 00:00:00 UTC. This clock implementation is
70    --  immune to the system's clock changes.
71
72    Relative          : constant := 0;
73    Absolute_Calendar : constant := 1;
74    Absolute_RT       : constant := 2;
75    --  Values for Mode call below. Note that the compiler (exp_ch9.adb) relies
76    --  on these values. So any change here must be reflected in corresponding
77    --  changes in the compiler.
78
79    procedure Timed_Delay (Time : Duration; Mode : Integer);
80    --  Implements the semantics of the delay statement when no tasking is used
81    --  in the application.
82    --
83    --    Mode is one of the three values above
84    --
85    --    Time is a relative or absolute duration value, depending on Mode.
86    --
87    --  Note that currently Ada.Real_Time always uses the tasking run time,
88    --  so this procedure should never be called with Mode set to Absolute_RT.
89    --  This may change in future or bare board implementations.
90
91 end System.OS_Primitives;