OSDN Git Service

2003-12-11 Ed Falis <falis@gnat.com>
[pf3gnuchains/gcc-fork.git] / gcc / ada / widechar.ads
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                         GNAT COMPILER COMPONENTS                         --
4 --                                                                          --
5 --                             W I D E C H A R                              --
6 --                                                                          --
7 --                                 S p e c                                  --
8 --                                                                          --
9 --          Copyright (C) 1992-1998 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 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,  59 Temple Place - Suite 330,  Boston, --
20 -- MA 02111-1307, 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 --  Subprograms for manipulation of wide character sequences
35
36 with Types; use Types;
37
38 package Widechar is
39
40    function Length_Wide return Nat;
41    --  Returns the maximum length in characters for the escape sequence that
42    --  is used to encode wide character literals outside the ASCII range. Used
43    --  only in the implementation of the attribute Width for Wide_Character.
44
45    procedure Scan_Wide
46      (S   : Source_Buffer_Ptr;
47       P   : in out Source_Ptr;
48       C   : out Char_Code;
49       Err : out Boolean);
50    --  On entry S (P) points to the first character in the source text for
51    --  a wide character (i.e. to an ESC character, a left bracket, or an
52    --  upper half character, depending on the representation method). A
53    --  single wide character is scanned. If no error is found, the value
54    --  stored in C is the code for this wide character, P is updated past
55    --  the sequence and Err is set to False. If an error is found, then
56    --  P points to the improper character, C is undefined, and Err is
57    --  set to True.
58
59    procedure Set_Wide
60      (C : Char_Code;
61       S : in out String;
62       P : in out Natural);
63    --  The escape sequence (including any leading ESC character) for the
64    --  given character code is stored starting at S (P + 1), and on return
65    --  P points to the last stored character (i.e. P is the count of stored
66    --  characters on entry and exit, and the escape sequence is appended to
67    --  the end of the stored string). The character code C represents a code
68    --  originally constructed by Scan_Wide, so it is known to be in a range
69    --  that is appropriate for the encoding method in use.
70
71    procedure Skip_Wide (S : String; P : in out Natural);
72    --  On entry, S (P) points to an ESC character for a wide character escape
73    --  sequence or to an upper half character if the encoding method uses the
74    --  upper bit, or to a left bracket if the brackets encoding method is in
75    --  use. On exit, P is bumped past the wide character sequence. No error
76    --  checking is done, since this is only used on escape sequences generated
77    --  by Set_Wide, which are known to be correct.
78
79    function Is_Start_Of_Wide_Char
80      (S    : Source_Buffer_Ptr;
81       P    : Source_Ptr)
82       return Boolean;
83    --  Determines if S (P) is the start of a wide character sequence
84
85 end Widechar;