OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [ada/] [s-imenne.adb] - Blame information for rev 713

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 706 jeremybenn
------------------------------------------------------------------------------
2
--                                                                          --
3
--                         GNAT RUN-TIME COMPONENTS                         --
4
--                                                                          --
5
--                  S Y S T E M . I M G _ E N U M _ N E W                   --
6
--                                                                          --
7
--                                 B o d y                                  --
8
--                                                                          --
9
--          Copyright (C) 2000-2009, Free Software Foundation, Inc.         --
10
--                                                                          --
11
-- GNAT 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
-- GNAT was originally developed  by the GNAT team at  New York University. --
28
-- Extensive contributions were provided by Ada Core Technologies Inc.      --
29
--                                                                          --
30
------------------------------------------------------------------------------
31
 
32
pragma Compiler_Unit;
33
 
34
with Ada.Unchecked_Conversion;
35
 
36
package body System.Img_Enum_New is
37
 
38
   -------------------------
39
   -- Image_Enumeration_8 --
40
   -------------------------
41
 
42
   procedure Image_Enumeration_8
43
     (Pos     : Natural;
44
      S       : in out String;
45
      P       : out Natural;
46
      Names   : String;
47
      Indexes : System.Address)
48
   is
49
      pragma Assert (S'First = 1);
50
 
51
      type Natural_8 is range 0 .. 2 ** 7 - 1;
52
      type Index_Table is array (Natural) of Natural_8;
53
      type Index_Table_Ptr is access Index_Table;
54
 
55
      function To_Index_Table_Ptr is
56
        new Ada.Unchecked_Conversion (System.Address, Index_Table_Ptr);
57
 
58
      IndexesT : constant Index_Table_Ptr := To_Index_Table_Ptr (Indexes);
59
 
60
      Start : constant Natural := Natural (IndexesT (Pos));
61
      Next  : constant Natural := Natural (IndexesT (Pos + 1));
62
 
63
   begin
64
      S (1 .. Next - Start) := Names (Start .. Next - 1);
65
      P := Next - Start;
66
   end Image_Enumeration_8;
67
 
68
   --------------------------
69
   -- Image_Enumeration_16 --
70
   --------------------------
71
 
72
   procedure Image_Enumeration_16
73
     (Pos     : Natural;
74
      S       : in out String;
75
      P       : out Natural;
76
      Names   : String;
77
      Indexes : System.Address)
78
   is
79
      pragma Assert (S'First = 1);
80
 
81
      type Natural_16 is range 0 .. 2 ** 15 - 1;
82
      type Index_Table is array (Natural) of Natural_16;
83
      type Index_Table_Ptr is access Index_Table;
84
 
85
      function To_Index_Table_Ptr is
86
        new Ada.Unchecked_Conversion (System.Address, Index_Table_Ptr);
87
 
88
      IndexesT : constant Index_Table_Ptr := To_Index_Table_Ptr (Indexes);
89
 
90
      Start : constant Natural := Natural (IndexesT (Pos));
91
      Next  : constant Natural := Natural (IndexesT (Pos + 1));
92
 
93
   begin
94
      S (1 .. Next - Start) := Names (Start .. Next - 1);
95
      P := Next - Start;
96
   end Image_Enumeration_16;
97
 
98
   --------------------------
99
   -- Image_Enumeration_32 --
100
   --------------------------
101
 
102
   procedure Image_Enumeration_32
103
     (Pos     : Natural;
104
      S       : in out String;
105
      P       : out Natural;
106
      Names   : String;
107
      Indexes : System.Address)
108
   is
109
      pragma Assert (S'First = 1);
110
 
111
      type Natural_32 is range 0 .. 2 ** 31 - 1;
112
      type Index_Table is array (Natural) of Natural_32;
113
      type Index_Table_Ptr is access Index_Table;
114
 
115
      function To_Index_Table_Ptr is
116
        new Ada.Unchecked_Conversion (System.Address, Index_Table_Ptr);
117
 
118
      IndexesT : constant Index_Table_Ptr := To_Index_Table_Ptr (Indexes);
119
 
120
      Start : constant Natural := Natural (IndexesT (Pos));
121
      Next  : constant Natural := Natural (IndexesT (Pos + 1));
122
 
123
   begin
124
      S (1 .. Next - Start) := Names (Start .. Next - 1);
125
      P := Next - Start;
126
   end Image_Enumeration_32;
127
 
128
end System.Img_Enum_New;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.