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

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc1/] [gcc/] [ada/] [g-encstr.ads] - Blame information for rev 513

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

Line No. Rev Author Line
1 281 jeremybenn
------------------------------------------------------------------------------
2
--                                                                          --
3
--                         GNAT RUN-TIME COMPONENTS                         --
4
--                                                                          --
5
--                    G N A T . E N C O D E _ S T R I N G                   --
6
--                                                                          --
7
--                                 S p e c                                  --
8
--                                                                          --
9
--                     Copyright (C) 2007-2008, AdaCore                     --
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 2,  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.  See the GNU General Public License --
17
-- for  more details.  You should have  received  a copy of the GNU General --
18
-- Public License  distributed with GNAT;  see file COPYING.  If not, write --
19
-- to  the  Free Software Foundation,  51  Franklin  Street,  Fifth  Floor, --
20
-- Boston, MA 02110-1301, USA.                                              --
21
--                                                                          --
22
-- As a special exception,  if other files  instantiate  generics from this --
23
-- unit, or you link  this unit with other files  to produce an executable, --
24
-- this  unit  does not  by itself cause  the resulting  executable  to  be --
25
-- covered  by the  GNU  General  Public  License.  This exception does not --
26
-- however invalidate  any other reasons why  the executable file  might be --
27
-- covered by the  GNU Public License.                                      --
28
--                                                                          --
29
-- GNAT was originally developed  by the GNAT team at  New York University. --
30
-- Extensive contributions were provided by Ada Core Technologies Inc.      --
31
--                                                                          --
32
------------------------------------------------------------------------------
33
 
34
--  This generic package provides utility routines for converting from
35
--  Wide_String or Wide_Wide_String to encoded String using a specified
36
--  encoding convention, which is supplied as the generic parameter. If
37
--  this parameter is a known at compile time constant (e.g. a constant
38
--  defined in System.WCh_Con), the instantiation is specialized so that
39
--  it applies only to this specified coding.
40
 
41
--  Note: this package is only about encoding sequences of 16- or 32-bit
42
--  characters into a sequence of 8-bit codes. It knows nothing at all about
43
--  the character encodings being used for the input Wide_Character and
44
--  Wide_Wide_Character values, although some of the encoding methods (notably
45
--  JIS and EUC) have built in assumptions about the range of possible input
46
--  code values. Most often the input will be Unicode/ISO-10646 as specified by
47
--  the Ada RM, but this package does not make any assumptions about the
48
--  character coding, and in the case of UTF-8 all possible code values can be
49
--  encoded. See also the packages Ada.Wide_[Wide_]Characters.Unicode for
50
--  unicode specific functions.
51
 
52
--  Note on brackets encoding (WCEM_Brackets). On input, upper half characters
53
--  can be represented as ["hh"] but the routines in this package will only use
54
--  brackets encodings for codes higher than 16#FF#, so upper half characters
55
--  will be output as single Character values.
56
 
57
with System.WCh_Con;
58
 
59
generic
60
   Encoding_Method : System.WCh_Con.WC_Encoding_Method;
61
 
62
package GNAT.Encode_String is
63
   pragma Pure;
64
 
65
   function Encode_Wide_String (S : Wide_String) return String;
66
   pragma Inline (Encode_Wide_String);
67
   --  Encode the given Wide_String, returning a String encoded using the
68
   --  given encoding method. Constraint_Error will be raised if the encoding
69
   --  method cannot accommodate the input data.
70
 
71
   procedure Encode_Wide_String
72
     (S      : Wide_String;
73
      Result : out String;
74
      Length : out Natural);
75
   --  Encode the given Wide_String, storing the encoded string in Result,
76
   --  with Length being set to the length of the encoded string. The caller
77
   --  must ensure that Result is long enough (see useful constants defined
78
   --  in System.WCh_Con: WC_Longest_Sequence, WC_Longest_Sequences). If the
79
   --  length of Result is insufficient Constraint_Error will be raised.
80
   --  Constraint_Error will also be raised if the encoding method cannot
81
   --  accommodate the input data.
82
 
83
   function Encode_Wide_Wide_String (S : Wide_Wide_String) return String;
84
   pragma Inline (Encode_Wide_Wide_String);
85
   --  Same as above function but for Wide_Wide_String input
86
 
87
   procedure Encode_Wide_Wide_String
88
     (S      : Wide_Wide_String;
89
      Result : out String;
90
      Length : out Natural);
91
   --  Same as above procedure, but for Wide_Wide_String input
92
 
93
   procedure Encode_Wide_Character
94
     (Char   : Wide_Character;
95
      Result : in out String;
96
      Ptr    : in out Natural);
97
   pragma Inline (Encode_Wide_Character);
98
   --  This is a lower level procedure that encodes the single character Char.
99
   --  The output is stored in Result starting at Result (Ptr), and Ptr is
100
   --  updated past the stored value. Constraint_Error is raised if Result
101
   --  is not long enough to accommodate the result, or if the encoding method
102
   --  specified does not accommodate the input character value, or if Ptr is
103
   --  outside the bounds of the Result string.
104
 
105
   procedure Encode_Wide_Wide_Character
106
     (Char   : Wide_Wide_Character;
107
      Result : in out String;
108
      Ptr    : in out Natural);
109
   --  Same as above procedure but with Wide_Wide_Character input
110
 
111
end GNAT.Encode_String;

powered by: WebSVN 2.1.0

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