OSDN Git Service

New Language: Ada
[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 --                            $Revision: 1.10 $                             --
10 --                                                                          --
11 --          Copyright (C) 1992-1998 Free Software Foundation, Inc.          --
12 --                                                                          --
13 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
14 -- terms of the  GNU General Public License as published  by the Free Soft- --
15 -- ware  Foundation;  either version 2,  or (at your option) any later ver- --
16 -- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
17 -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
18 -- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
19 -- for  more details.  You should have  received  a copy of the GNU General --
20 -- Public License  distributed with GNAT;  see file COPYING.  If not, write --
21 -- to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston, --
22 -- MA 02111-1307, USA.                                                      --
23 --                                                                          --
24 -- As a special exception,  if other files  instantiate  generics from this --
25 -- unit, or you link  this unit with other files  to produce an executable, --
26 -- this  unit  does not  by itself cause  the resulting  executable  to  be --
27 -- covered  by the  GNU  General  Public  License.  This exception does not --
28 -- however invalidate  any other reasons why  the executable file  might be --
29 -- covered by the  GNU Public License.                                      --
30 --                                                                          --
31 -- GNAT was originally developed  by the GNAT team at  New York University. --
32 -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
33 --                                                                          --
34 ------------------------------------------------------------------------------
35
36 --  Subprograms for manipulation of wide character sequences
37
38 with Types; use Types;
39
40 package Widechar is
41
42    function Length_Wide return Nat;
43    --  Returns the maximum length in characters for the escape sequence that
44    --  is used to encode wide character literals outside the ASCII range. Used
45    --  only in the implementation of the attribute Width for Wide_Character.
46
47    procedure Scan_Wide
48      (S   : Source_Buffer_Ptr;
49       P   : in out Source_Ptr;
50       C   : out Char_Code;
51       Err : out Boolean);
52    --  On entry S (P) points to the first character in the source text for
53    --  a wide character (i.e. to an ESC character, a left bracket, or an
54    --  upper half character, depending on the representation method). A
55    --  single wide character is scanned. If no error is found, the value
56    --  stored in C is the code for this wide character, P is updated past
57    --  the sequence and Err is set to False. If an error is found, then
58    --  P points to the improper character, C is undefined, and Err is
59    --  set to True.
60
61    procedure Set_Wide
62      (C : Char_Code;
63       S : in out String;
64       P : in out Natural);
65    --  The escape sequence (including any leading ESC character) for the
66    --  given character code is stored starting at S (P + 1), and on return
67    --  P points to the last stored character (i.e. P is the count of stored
68    --  characters on entry and exit, and the escape sequence is appended to
69    --  the end of the stored string). The character code C represents a code
70    --  originally constructed by Scan_Wide, so it is known to be in a range
71    --  that is appropriate for the encoding method in use.
72
73    procedure Skip_Wide (S : String; P : in out Natural);
74    --  On entry, S (P) points to an ESC character for a wide character escape
75    --  sequence or to an upper half character if the encoding method uses the
76    --  upper bit, or to a left bracket if the brackets encoding method is in
77    --  use. On exit, P is bumped past the wide character sequence. No error
78    --  checking is done, since this is only used on escape sequences generated
79    --  by Set_Wide, which are known to be correct.
80
81    function Is_Start_Of_Wide_Char
82      (S    : Source_Buffer_Ptr;
83       P    : Source_Ptr)
84       return Boolean;
85    --  Determines if S (P) is the start of a wide character sequence
86
87 end Widechar;